php based crawler/scraper for the page loaded with jquery -


i working on script loads html page of ecommerce site. script fine enable provide me html added jquery on page.

is there way resolve this?

i using below code:-

currently using meta tags fetching data.

$url = "https://www.flipkart.com/pureit-classic-23-l-gravity-based-water-purifier/p/itmefqycwh7mgwan?pid=wapefqy5yewy4zgt&srno=s_1_5&otracker=search&lid=lstwapefqy5yewy4zgto514um&qh=d5e3b0f34459bd7d";  $response = getpricefromflipkart($url); echo '<pre>'; print_r($response); echo '</pre>'; /* returns response in json format */  function getpricefromflipkart($url) {      $curl = curl_init($url);     curl_setopt($curl, curlopt_useragent, "mozilla/5.0 (windows; u; windows nt 10.10; labnol;) ctrlq.org");     curl_setopt($curl, curlopt_failonerror, true);     curl_setopt($curl, curlopt_followlocation, true);     curl_setopt($curl, curlopt_returntransfer, true);     $html = curl_exec($curl);     curl_close($curl);      $regextitle = '/<meta name="og_title" property="og:title" content="([^"]*)"/';     preg_match($regextitle, $html, $title);     $regexdesc = '/<meta name="description" content="([^"]*)"/';     preg_match($regexdesc, $html, $desc);     $price = get_string_between($desc[1], 'rs.', 'from');      if ($price && $title) {         $response = array("price" => "rs. $price.00", "title" => $title[1], "description" => $desc[1]);     } else {         $response = array("status" => "404", "error" => "we not find product details on flipkart $url");     }     return $response; }  function get_string_between($string, $start, $end) {     $string = ' ' . $string;     $ini = strpos($string, $start);     if ($ini == 0)         return '';     $ini += strlen($start);     $len = strpos($string, $end, $ini) - $ini;     return trim(substr($string, $ini, $len)); } 


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -