I am trying to retreive the body text located in this span class attribute.
<span id="" style="color:#525B64;">The quick brown fox jumped over the lazy dog.</span>
I tested it on my web server and I get no errors but the page is blank. I'm very new to this so I do not know where to go from here.
Here is my code.
<?php
// Load remote file, supress parse errors
libxml_use_internal_errors(TRUE);
$dom = new DOMDocument;
$dom->loadHTMLFile('http://somewebpage.com');
libxml_clear_errors();
// use XPath to find all nodes with a class attribute of header
$xp = new DOMXpath($dom);
$nodes = $xp->query('//span[@class="msgBody"]');
// output first item's content
echo $nodes->item(0)->nodeValue;
?>