有没有可能使用脚本语言 PHP 的 IP 来查找国家/地区名称的方法?

2022-01-14 00:00:00 ip-address geolocation php

有没有任何可能的方法使用脚本语言 PHP 的 IP 来查找国家/地区的名称?

Is there any possible way to find the name of the country using IP with scripting language PHP ?

推荐答案

根据您在预算水平和准确性水平上的需求,有几个选项:

Depending on your needs at a budget level and an accuracy level there are a few options:

IPGeo:www.ipgeo.com(免费选项)

IPGeo: www.ipgeo.com (Free option)

MaxMind GeoIP:http://www.maxmind.com/(免费选项)

MaxMind GeoIP:http://www.maxmind.com/ (Free option)

Quova:http://quova.com/(付费)

NetAcuity by Digital Element/Envoy:http://www.digital-element.com/(付费)

NetAcuity by Digital Element/Envoy: http://www.digital-element.com/ (Paid)

Digital Envoy 是 IP 智能领域的发明者,拥有所有提供商中最丰富的数据集,被认为是行业领导者.他们提供企业级解决方案和性能,这可能是也可能不是您正在寻找的.如果您只对国家级数据感兴趣,那么这些提供商中的大多数应该能够满足您的需求(准确性方面),因为从技术角度来看,查找 IP 地址所在的国家并不困难.如果您的预算是免费的,那么我的建议是使用 MaxMind 提供的数据.

Digital Envoy is the inventor of the IP Intelligence space, has the richest dataset of all the providers, and is considered the industry leader. They offer enterprise level solutions and performance, which may or may not be what you're looking for. If all you're interested in is country level data, then most of these providers should be able to suit your needs (accuracy wise) as finding the country of the IP address is not difficult from a technical standpoint. If your budget is free, then my advice would be to use the data provided by MaxMind.

如果在未来,您发现自己需要更精细的地理数据(即城市级数据),那么这些提供商之间的准确性差异很大,MaxMind 和 Digital Envoy 占据上风,而 Digital Envoy 拥有最好的整体解决方案.

If down the road, you find yourself in need of more granular geographic data (i.e. city level data), then the accuracy between these providers varies greatly with the upper hand going to MaxMind and Digital Envoy, with Digital Envoy having the best overall solution.

关于用户对代理的评论之一,这可能是一个问题.某些网络(例如 AOL)通过代理路由其所有数据.通常,该代理与原始连接位于同一国家/地区,因此国家级数据与用户未使用代理一样准确.显然,如果有人想在其国家/地区以外使用代理,他们可以,但这是例外,而不是一般互联网流量的规则.一些提供商提供代理数据库,或标记已知为代理的范围,以便您作为用户可以选择是否出于您的目的信任它.

In regard to one of the users comments about proxies, this can be an issue. Some networks (such as AOL) route all their data through a proxy. Usually that proxy is located within the same country as the originating connection, so the country level data is as accurate as if the user wasn't using a proxy. Obviously if someone wants to use a proxy outside their country they can, but this is the exception not the rule for general internet traffic. Some providers offer a proxy database, or flag ranges known to be proxies, so that you as the user can choose whether or not to trust it for your purposes.

相关文章