package for detecting users contry in php? [closed]
سؤال
I want to know what is the best package to detect country which user is visiting from?
I am using php/mysql..
المحلول
I think there is not a guaranteed way but there are some options:
- You can use GeoIP
- You can check the
HTTP_ACCEPT_LANGUAGE
header($_SERVER
) - Use any IP-To-Country database
نصائح أخرى
You can download the MaxMind GeoLite Country database, and use that to lookup the IP of user to determine their country.
There are paid versions of that database, but I've found the accuracy of the free database more than sufficient.
لا تنتمي إلى StackOverflow