Reliable Geo-IP urban layer, free local database

I want to build a PHP script to resolve the city name (nothing else is needed) with good resolution only for a particular country (IRAN). Since I have to query the database several times, it is better to view the downloadable local version. I read most of the posts on stackoverflow, and now I have tested them:

  • Maxmind's GeoIP City sounds good, but it's not free.
  • GeoIP from maxmind, has a low level of accuracy (about 50-60%)
  • ip2country.net has an IP-2-City database, but is not free and does not allow city names for Iran.
  • I also tried DB # .Lite from ipinfodb.com, which has an API here without any success. The problem is that it does not detect many city names.
  • I also tried the hostip.info API , but it seems too slow.
  • There is a free php class with a local database that allows only the name of the country.
  • I do not know if there is a chance to use Piwik with this GeoIP plugin . It would be helpful to have ideas if anyone knows about this.
  • ipinfo.io is another service that definitely does not resolve city names.
  • I don’t know if there is a way to use Google Analytics for resolving city names, since I believe that Google will be better than any other service in relation to countries such as Iran.

Any good idea would be really appreciated.

+6
source share
3 answers

It is heavy and reliable. I let him go back in time, and he went something like this.

Paid services that can do this very quickly for you. It can take a long time to get something working that is still unreliable because you simply do not have data. I would seriously think http://www.maxmind.com/en/city_per - if, of course, this is not a completely commercial project, and $ - no.

If you can get lat and long from the IP table, even without city data, then you can use something like this to check that the nearest Javascript city is optio n - Search for the nearest list (array?) Of the city from a known location .

What about browser sharing?

+4
source

If a browser solution works for your use case, you can look at the MaxMind GeoIP2 JavaScript API . First, he tries to find the user using HTML5 geolocation, and if this fails or is inaccurate, he returns to MaxMind GeoIP2 City data (not GeoLite). MaxMind provides a free version of attribution.

0
source

Sometimes we need to use a local Geo-IP database instead of web services for specific purposes. This is my experience: I downloaded the database form https://db-ip.com . I searched a lot and finally I found it even more reliable. but two more problems:

  • 1. The database "IP-address in the city" is too large to load the MYSQL database on the hosting, because it limits the waiting time.
  • 2-Database is based on a comparison of IP addresses http://lite.ip2location.com The database is a database of IP numbers.

So, I developed a simple .NET application to solve these problems. The solution can be downloaded here: https://github.com/atoosi/IP2Location-Database-Luncher

0
source

Source: https://habr.com/ru/post/950983/


All Articles