John Adawan John Adawan - 1 year ago 111
PHP Question

simple php script to retrieve google keyword search completion

I am trying to retrieve just the search completion shown in Google search result for any keyword. For example the search completion for

is 48,400,000 (Results 1 - 10 of about 48,400,000 for google keyword search)

I tried to use CURL but fail to retrieve the search result page.

Any help appreciated.

Answer Source

You don't need to do anything nearly that complicated.

Just use their search API

$search = 'google keyword search';
$results = json_decode( file_get_contents( '' . urlencode( $search ) ) );

echo $results->responseData->cursor->estimatedResultCount;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download