使用GeoIP数据库的最佳方式

时间:2022-08-06 23:11:37

Can anyone please let me know what's the best way of using the GeoIP databases in order to detect the country of visitors by IP.

任何人都可以让我知道使用GeoIP数据库的最佳方式是什么,以便通过IP检测访问者的国家。

I used to have a table populated with IPv4 information ( longstart, longend, country code ) and with an INET_ATON() instruction I would get the relevant country code.

我曾经有一个填充了IPv4信息的表(longstart,longend,国家代码)和INET_ATON()指令,我会得到相关的国家代码。

However, we would now want to use the IPv6 database and grab country code for IPv6 IPs as well. But not sure what's the best way to use these databases. I can see they offer various databases now(geolite legacy, or geolite 2, or the APIs), they also offer some update script - not sure how this works though, or in relation with what.

但是,我们现在想要使用IPv6数据库并获取IPv6 IP的国家/地区代码。但不确定使用这些数据库的最佳方法是什么。我可以看到他们现在提供各种数据库(geolite遗产,或geolite 2,或API),他们还提供一些更新脚本 - 不确定这是如何工作的,或与之相关。

Any help would be appreciated. Thank you.

任何帮助,将不胜感激。谢谢。

1 个解决方案

#1


Have you tried using http://php.net/manual/en/intro.geoip.php

您是否尝试过使用http://php.net/manual/en/intro.geoip.php

You can also use Maxmind's downloadable GeoIP Database here http://dev.maxmind.com/geoip/geoip2/geolite2/

你也可以在这里使用Maxmind的可下载GeoIP数据库http://dev.maxmind.com/geoip/geoip2/geolite2/

#1


Have you tried using http://php.net/manual/en/intro.geoip.php

您是否尝试过使用http://php.net/manual/en/intro.geoip.php

You can also use Maxmind's downloadable GeoIP Database here http://dev.maxmind.com/geoip/geoip2/geolite2/

你也可以在这里使用Maxmind的可下载GeoIP数据库http://dev.maxmind.com/geoip/geoip2/geolite2/