1

Can anyone tell me how to do that, just like when I surf google.com it directs me to google.co.uk. Thanks!

wes
  • 7,795
  • 6
  • 31
  • 41
dramasea
  • 3,370
  • 16
  • 49
  • 77

1 Answers1

1

This is called IP geolocation. There are a great variety of services and libraries for this. You can get more specifics if you tell us what platform you're on.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
  • if i'm not wrong i've heard about it, but i think it's only support in browser which support html5? – dramasea Dec 29 '10 at 08:25
  • No. The server is what's sending the redirect (google.com->google.co.uk) header, and there's no HTML involved. You're right that HTML 5 provides client-side geolocation. However, it's used for other purposes, and often relies on Wi-Fi or GPS data, rather than just IP geolocation. – Matthew Flaschen Dec 29 '10 at 08:28
  • where can i get the api?Thanks! – dramasea Dec 29 '10 at 08:31
  • @drama, as I said, tell us what platform (language, etc.) you're on. – Matthew Flaschen Dec 29 '10 at 08:32
  • In that case, check out [Is there any possible way to find the name of the country using IP with scripting language PHP ? ](http://stackoverflow.com/questions/1543437/is-there-any-possible-way-to-find-the-name-of-the-country-using-ip-with-scripting). – Matthew Flaschen Dec 29 '10 at 08:40