I've been working on some practice application involving xPaths and Retrieving elements from other website.
I used DomXpath for it but it is not returning a result or nodelist.
Here's the code:
$DOM = new DOMDocument();
@$DOM->loadHTML($html);
$xpath = new DOMXPath($DOM);
$nodes = $xpath->query("//span[contains(@style,'font-size:25px;')]");
foreach ($nodes as $node) {
echo $node->nodeValue;
}
The page source of the example:
<div class="front-view-content full-post">
<p>
<span style="font-size:25px; color:#98293D;">RED</span><br>
<span style="font-size:25px; color:#98293D;">BLUE</span><br>
<span style="font-size:25px; color:#98293D;">WHITE</span></p>
</div>
it doesn't return anything just a plain blank.