I have the following this weather site
And i need to using Xpath but icant return query!
I'm using this xPath and must return 2 Row
$xpath->query('/html/body/table[3]/tbody/tr/td/table/tbody/tr/td[2]/p/table/tbody/tr/td/font/div/center/table/tbody/tr[1]/td[1]/font/font/b');
but not return anythings:
please complete this xpath
i'm using this cod butt show error
Catchable fatal error: Object of class DOMNodeList could not be converted to string in /home/mysite/curl.php on line 23
<?php
$url="http://www.irimo.ir/farsi/current/index.asp?station=40770";
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$dom = new DomDocument();
@$dom->loadHTML($allcont);
$xpath = new DomXPath($dom);
$return = $xpath->query('/html/body/table[3]/tbody/tr/td/table/tbody/tr/td[2]/p/table/tbody/tr/td/font/div/center/table/tbody/tr[3]/td/font/b');
echo $return;
echo $xpath;
?>