php - Extracting value for different url causes error -


my initial script finding price on flipkart url http://www.flipkart.com/moto-g-2nd-gen/p/itme6g3wferghmv3 works when go find price url http://www.flipkart.com/samsung-galaxy-core-2-sm-g355hzwdins/p/itmdy3h6qhgz2phv script gives error:

fatal error: call member function find() on boolean in c:\users\abhishek\desktop\editor\request\main.php on line 18

here code:

<?php $url="http://www.flipkart.com/samsung-galaxy-core-2-sm-g355hzwdins/p/itmdy3h6qhgz2phv";  $ch = curl_init(); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_useragent, "user-agent: mozilla/5.0 (windows nt 6.3; wow64; rv:37.0) gecko/20100101 firefox/37.0"); curl_setopt($ch, curlopt_followlocation,1); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_encoding, ""); $pagebody=curl_exec($ch); curl_close ($ch);  include('simple_html_dom.php'); $html = str_get_html($pagebody);  foreach($html->find('.selling-price') $e)     echo $e->outertext . '<br>';      ?> 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -