I'm trying to use PHP to return the resultant HTML of a 开发者_C百科Google search.
So for instance
<?php
$file = file_get_contents('http://www.example.com',false);
echo $file;
?>
will return the HTML contents of example.com. The problem is, when I try to do this on a Google search URL, e.g., http://www.google.com/#sclient=psy&hl=en&q=cats, it returns the HTML from the main Google page and NOT the search results for 'cats'.
What's the easiest way to do this?
You want a URL of this form:
http://www.google.com/search?q=cats
The URL you're using is for their new "instant search"
OK, I've answered my own question. Sorry. If I turn Google Insant off, it works fine on a URL like http://www.google.com/search?hl=en&q=cats
Thanks anyway!
精彩评论