0

So I am trying to write a script that querys a website from multiple different locations and devices and records the results, I am using google as the benchmark for this.

From what I have read it seems Google uses nearby WiFi networks to pinpoint your location. I am not on wireless however so it seems it just guesses based on your ip. If this is the case, will it be possible to do this without using a proxy of some kind?

Now what I have so far is written in php and uses curl to set the relevant options. I am using curl in order to change the user agent to fake different devices. Is it possible to use curl to change the location data also?

If curl is not the best way to do this then I am open to change to a different method, but any alternative would need a way to set the user agent as well as location.

I have seen from this post that you can override what your current position in Chrome is via the Geolocation API. I am concerned however that this will only change the location locally (ie after you have a response), so would defeat the purpose. Also, I am not sure where this code needs to be written. Would it be in the javascript in the browser itself? So not useful for an external script?

Any thoughts appreciated!

Community
  • 1
  • 1

3 Answers3

1

You can use the device emulation

here

Flexo
  • 87,323
  • 22
  • 191
  • 272
  • I did try this but google is more clever than that. When you do this on a google search it seemed to still think I was in London Edit: I should be more specific. This works on google maps, but doing a google search would give adverts for London services (I tested with setting my coords to the Eiffel tower in an incognito session). – Phil Barber Nov 10 '15 at 13:50
0

You are able to specify location in settings for search query.

Or use NCR links with curl, like http://www.google.com/ncr

This works for other countries too, so for example I was able to go to Deutschland Google with:

http://www.google.de/ncr

iXCray
  • 1,072
  • 8
  • 13
  • I need to be able to be precise enough to search from a city, not just a country. Is this possible through ncr? Also, what do you mean by the settings for the search query? – Phil Barber Nov 10 '15 at 13:40
0

You can try something along these lines

curl_setopt( $curl, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip_to_show", "HTTP_X_FORWARDED_FOR: $ip_to_show"));

Which might or might not work depending on who you try to fool (you are not changing your actual ip but your http request headers, if they listen to that you are set)

Elentriel
  • 1,237
  • 8
  • 21