Why there's no output or text shown on the browser with my code

I already build a script to scrape or extract data from a website using xpath. It runs succesfully without any error displayed yet I didn’t get the value or prints text.
Here’s the code:
[php]$dom = new DOMDocument();
$dom->loadHTML($Url);
$xpath = new DomXPath($dom);
$nodes = $xpath->query(’//span[@style=“font-size:25px; color:#98293D”]’);
foreach ($nodes as $node) {
echo $node->nodeValue;
}[/php]

Can you verify it if there’s any wrongdoing I’ve done.

Here’s the source of the selected element I want to scrape to.

[code]p data-iceapw=“6” data-iceapc=“3”>

<span style="font-size:25px; color:#98293D;" data-iceapw="2"></span>
<br></br>
<span style="font-size:25px; color:#98293D;" data-iceapw="2"></span>
<br></br>
<span style="font-size:25px; color:#98293D;" data-iceapw="2"></span>
[/code]

I hope I would given an answer in the shortest span.

Regards.

Change:

[php]$nodes = $xpath->query(’//span[@style=“font-size:25px; color:#98293D”]’);[/php]

To:

[php]$nodes = $xpath->query(’//span[@style=“font-size:25px; color:#98293D;”]’);[/php]

Also you have loadHTML - Doesn’t take a URL - you have to pass in the HTML

http://php.net/manual/en/domdocument.loadhtml.php

Sponsor our Newsletter | Privacy Policy | Terms of Service