Question

As in normal Google search page, Google returns me results specific to my location. As i am considering/assuming for this, it gets my ip address my request, find uses location for it and returns the results.

I am writing the proxy server for search engines. So from user browser i get requests for some search terms and server returns search results.

I am curious to know, if from Custom Search API can i get the such results based on some IP address i provide or anything like that, so that i can mock the user location in my proxy server and pretend the Google Custom Search to be that user and get the location specific results

PS.I am new to this search engine api world, so please understand me.

Was it helpful?

Solution

Yes, you can, but just for the country, not the exact location.

Here is the docs for parameters of a query request:
https://developers.google.com/custom-search/json-api/v1/reference/cse/list Look at the 'gl' parameter.

I'm not aware of any way to specify the location more precisely then this.

OTHER TIPS

After these many years I'm not sure if you still need it, but I found it hard to find a helpful answear, so here's the solution for whoever needs it.

You can achieve that behavior with the "?gl=" query param as mentioned here, and pass the value as one of the country codes.

Worked for me, hope it helps someone!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top