: How to detect visitor's country from his IP for my PHP website right on the server the problem: I need to detect visitor's country from his IP so I can display specific code based on the
the problem:
I need to detect visitor's country from his IP so I can display specific code based on the user location (different ads, etc.) in my PHP website.
There is many different external services such as Ip-api.org which does this, but I want to do it internally on the server (it's faster).
The question:
How to do it? What do I need to install or what do google out?
Update:
Ideally with some open-source licence.
More posts by @Si4351233
1 Comments
Sorted by latest first Latest Oldest Best
dev.maxmind.com/geoip/geoip2/geolite2/
This will give you a database of IP ranges and associated country. You can query this with PHP to find out the country for a given IP address.
Make sure you read the license conditions. You will also need to keep the data updated, as otherwise it will get less accurate over time.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.