curl - Track google instant search result for occupation of people using php -

please check image, need track occupation of famous people. think instant result google choice.
this result populated dynamically javascript, used curl , file contents, getting static html, ie ) not getting dynamically loading "andy warhol professions" ( white box contents in left side ).
how google instant result using google search url's like
https://www.google.co.in/search?q=andy+warhol+occupation https://www.google.co.in/search?q=sachin+tendulkar+occupation https://www.google.co.in/search?q=barack+obama+occupation
not tested should work
$page = file_get_contents('https://www.google.co.in/search?q=andy+warhol+occupation'); $doc = new domdocument(); $doc->loadhtml($page); $divs = $doc->getelementsbytagname('div'); foreach($divs $div) { if ($div->getattribute('id') === 'rso') { echo $div->nodevalue; } }
Comments
Post a Comment