Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to get the user country?

I need a way to know the user country to make the routing according the language of user and after make the translation to your language

    Ex: 
    mysite.com/en/page
    mysite.com/fr/page

How do i make this?

The language should be to getting automatically and the user redirected to your correspondence language if this version exist, case not there's, the user may be redirect to default language, for example english



6.1k
Accepted
answer

You can use HTTP header accept_language or you can use maxmind to detect user country based on their IP address. Here is some refrence http://stackoverflow.com/questions/10987646/accuracy-of-accept-language-to-detect-country



223

Try PHP GeoIPLocation Library it is Simple


Custom Essay Writing Service