How to get the number of results found for a keyword on Google

I need to specify a keyword, for example "blue metal kettle" (with quotes / without quotes), and get only the number of results found for this search. If I search without quotes right now, I get:

Results 1 - 10 of about 1,040,000 for blue metal kettle. (0.19 seconds) 

Here '1,040,000' is the number I want. Is there any API function for this, or should I extract this number via HTML? What is the best way to do this?

+4
source share
3 answers

The JSON Google Ajax API has a ratedResultsCount property, but you can read about unresolved complaints filed in the error tracker:

The number of results varies http://code.google.com/p/google-ajax-apis/issues/detail?id=32

(I see that the question is tagged with PHP, but client-side javascript in the connection may be of interest.)

+1
source

You can screen it. Sort of:

 $keywords = "blue metal kettle"; $html = file_get_contents("http://www.google.com/?q=" . rawurlencode($keywords)); preg_match('/Results 1 - \d+ of about ([0-9,]+) for/', $html, $reg); var_dump($reg[1]); 

If you use this in an application, you are likely to violate Google’s terms of use.

+1
source

Google has closed its API for public use for quite some time. If you want to use a supported API, check out the bing api that provides this as part of its results. Otherwise, you can clear the HTML. Please note that you have specified formatting for our / English numbers. Formatting will differ from other google sites and / or your profile settings and / or your browser settings.

-one
source

All Articles