PHP 的 GeoIP 类的方法总是能实现吗?
我想实现一个基于国家/地区的网页。如果传入请求来自美国,我希望我的脚本将用户重定向到 usa.html;如果来自阿根廷,则转到 arg.html 等。但我希望它是准确的。例如,如果用户从法国和德国之间的边界连接到互联网(假设他是从法国连接的),则脚本不得将他重定向到 germany.html,因为该用户的 ISP 位于法国境内。在这种情况下,GeoIP 能给出准确的结果吗?
I want to implement a country-based web-page. If incoming request is from USA, I want my script to redirect the user to usa.html; if it is from Argentina, then to arg.html and so on. But I want it to be exact. For example, if a user that connects to internet from the boundary between France and Germany (he is connecting from France let's say), the script must not redirect him to germany.html because the user's ISP is in the boundaries of France. Does GeoIP give exact results in such cases?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它永远不会100%准确。
我给你举个例子。我在我的笔记本电脑上使用 O2 Telefonica Slovakia 的预付费移动互联网。
他们的骨干由捷克共和国的 O2 Telefonica Czech 维护。
它总是说我的 IP 在捷克共和国,但我不在那儿;)。我知道,它是移动互联网,不是 DSL 或任何宽带,但请注意,给予某些 ISP 的 IP 块可以在更多国家/地区共享,因为它不需要受到国家边界的限制。很多ISP共享IP块,因为ISP在周围更多的国家提供相同的服务。
然而,如果谈论静态 IP,是的,存在静态 IP,并且应该由 GeoIP 正确报告。这就是 maxmind 每月更新其数据库的主要原因。
It will never be 100% accurate.
I give you an example.I use prepaid mobile internet in my laptop from O2 Telefonica Slovakia.
Their backbone is maintained in Czech republic by O2 Telefonica Czech.
It always said that my IP is in Czech republic, but I'm not hthere ;).I know, it mobile internet, not DSL or any broadband, but please note that IP block given to some ISP can be shared accors more countries, because it does not needs to be restricted by country border.Lot of ISP has shared IP blocks because ISP is providing same service in more countries around.
Hovever, if talking about static IP's, yes there are static and should be reported by GeoIP correctly.This is main reason why maxmind updating every month theirs database.
GeoIP 并不准确,但原因却并非您想象的那样。 GeoIP 或其他类似服务没有什么神奇之处:它只是一个将 IP 地址范围与国家/地区代码链接起来的数据库。他们不知道用户在哪里。
GeoIP is not exact, but not for the reason you think. There's nothing magical in the GeoIP or other similar services: it's just a database that links an IP address range with a country code. They don't know where the user is.
这取决于您为 GeoIP 数据库支付的费用。
it depends on how much you pay for the GeoIP database.