Is it possible to scrape the Google search results page using PHP to pull out the total number of search results found?
If so how would I go about doing this?
Thanks
Is it possible to scrape the Google search results page using PHP to pull out the total number of search results found?
If so how would I go about doing this?
Thanks
This PHP class does it: http://www.phpclasses.org/browse/package/3924.html
"This class can be used to get the total number of results for given Google search query.
It accesses the Google search site to perform a query for given search terms.
The class parses the results page and extract the total number of results that the given search query returned."
try this using phpsimplehtmlparser
$search_query = 'google';
$url = sprintf('http://www.google.com/search?q=%s', $search_query);
$html = file_get_html($url);
$results = $html->find('#resultStats/b', 2)->innertext;
echo sprintf('Google found %s results for "%s"', $results, $search_query);