If you view the code, the price is placed in the following SPAN
Rs. 37,500 // Fetch this price
My code to fetch this so far is :
$curl = curl_init('http://www.flipkart.com/apple-iphone-5s/p/itmdv6f75dyxhmt4?pid=MOBDPPZZDX8WSPAT');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$page = curl_exec($curl);
if(!empty($curl)){ //if any html is actually returned
$pokemon_doc->loadHTML($curl);
libxml_clear_errors(); //remove errors for yucky html
$pokemon_xpath = new DOMXPath($pokemon_doc);
//get all the h2's with an id
$pokemon_row = $pokemon_xpath->query('//h2[@id]');
if($pokemon_row->length > 0){
foreach($pokemon_row as $row){
echo $row->nodeValue . "
";
}
}
}
else
print "Not found";
?>
This shows an error :
Fatal error: Call to a member function loadHTML() on a non-object in
D:\xampp\htdocs\jiteen\php-scrape\phpScrape.php on line 9
What shall I do, I can't trace the error