John Adawan John Adawan - 4 months ago 14x
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.


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;