I have the following structure:
<div class="xGh" style="background-image: url('name_file.jpg');"></div>
Where do I need to capture:
name_file.jpg
I tried to use the solution featured in this response , but not working, has a syntax error:
See test with error on Ideone
$img = $xpath->query(substring-before(substring-after(//div[@class='xGh']/@style, "background-image: url('"), "')"));
echo $img->item($i)->nodeValue."<br/>";
I know how to do with regex
, but I wanted to use xpath
, is it possible?