I trying to get my head around how to fetch Google search results with PHP or JavaScript. I know it has been possible before but now I can\'t find a way.
I am trying to
I did it earlier. Generate the html contents by making https://www.google.co.in/search?hl=en&output=search&q=india
http request, now parse specific tags using the htmldom php library. You can parse the content of result page using PHP SIMPLE HTML DOM
DEMO : Below code will give you title of all the result :
find('li[class=g]') as $element) {
foreach($element->find('h3[class=r]') as $h3)
{
$title[$i] = ''.$h3->plaintext.'
' ;
}
$i++;
}
print_r($title);
?>