Trying to scrape images and data from a website using Xpath but keeps showing me an error.Could anybody help me out.
<?php
$dom = new DOMDocument();
@$dom->loadHTMLFile('http://www.hassconsult.co.ke/index.php?option=com_content&view=article&id=22&Itemid=29');
$xpath = new DOMXPath($dom);
foreach($xpath->query("//div[@id='ad']/table") as $table) {
echo $xpath->query(".//img[@align='centre']", $table)->item(0)->nodeValue . "
";// should come in here don't know what to put
echo $xpath->query(".//span[@class='style8']", $table)->item(0)->nodeValue."
";
echo $xpath->query(".//div[@class='style10']/div", $table)->item(0)->nodeValue."
";
echo $xpath->query("//div[@align='justify']", $table)->item(0)->nodeValue. "
";
}
?>
This is the outline as given buy firebug
<td>
<div align="center" style="border:1px #007AC7 solid;width:199px;height:131px;">
<a href="/index.php?option=com_content&view=article&id=27&Itemid=74&send=5&ref_no=834/II">
<img width="199" height="131" border="0" style="border:1px #007AC7 solid;" alt="Photo" src="/images/markers/l_569.jpg">
</a>
</div>
</td>