简体   繁体   English

使用GeoIP数据库的最佳方式

[英]Best way of using GeoIP databases

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

Any help would be appreciated. 任何帮助,将不胜感激。 Thank you. 谢谢。

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/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM