0

Possible Duplicate:
IP to Country?

I would like to know how I can detect the language and country of a visitor to my website. It is my understanding that it is best to get this information from the IP but I don't know how to do that. Is this the method that large e-commerce sites use? If there is a database of location based on IP will it remain valid for a while or does that sort of information change rapidly?

Community
  • 1
  • 1
Osama Tarek
  • 297
  • 5
  • 16
  • 2
    please don't base the language of the site on user location. and if you have to, then allow them to change the language. – MCannon Jul 29 '11 at 01:25

1 Answers1

0

It looks like using the IP is not the ultimate nor the best way to detect at least the language and also the country of a visitor. As for the language, a good and effective way would be to use the http headers to get the language of the user´s browser or OS and then to adapt the language of the site to the collected data. As MCannon mentions, in any case, it is always good to let the user change the language (as an example, my OS and browser are not in English but still, for some sites, I´d rather read and thus have the English version of the site). As for the location of the user, I ran myself into such a problem and I was adviced by lethalMango a very good website and API that I am advising to you, so check the site IP info, where you can find a wonderful database and access it using their API Hope it helps!

Iam Zesh
  • 1,797
  • 2
  • 20
  • 42