Get the city name from a user’s IP address in PHP (free up to 50K requests per month)
In a WordPress blog, I wanted to display different content to users depending on their location. It is possible using IPInfo.io (for free until 50k requests a month, then you can get a paid plan). Here is how to get the city name or country name from an IP.