dongyihao1099 2012-08-23 09:21
浏览 107
已采纳

GeoIP IPv4数据库返回错误的国家/地区代码 - 需要进行GeoIP更新?

I am using the following code with the IPv4 database, however I am noticing a number of IP addresses coming with the wrong country code.

Is there a updated binary GeoIP database for IPv4?

Looking at http://maxmind.com/download/geoip/database/ it appears there are only updates for IPv6.

include("geoip.inc");

$gi = geoip_open("/usr/local/share/GeoIP/GeoIP.dat",GEOIP_STANDARD);

echo geoip_country_code_by_addr($gi, "24.24.24.24") . "\t" .
     geoip_country_name_by_addr($gi, "24.24.24.24") . "
";
echo geoip_country_code_by_addr($gi, "80.24.24.24") . "\t" .
     geoip_country_name_by_addr($gi, "80.24.24.24") . "
";
  • 写回答

1条回答 默认 最新

  • dongling0519 2012-08-23 10:20
    关注

    It appears that GeoIP do update the IPv4 database and they are made available here. They state that they update it on the first Tuesday of every month and it is available for free.

    I was probably using an old version of the binary database, and after updating it the IPs were returning the correct country code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 YOLOv8obb获取边框坐标时报错AttributeError: 'NoneType' object has no attribute 'xywhr'
  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸