mod_geoip2 和 php pecl-geoip:如何通过 ip 地址查询?
如何使用 php 查询 geoip 数据库?
我安装了 mod_geoip2 的 apache2 和 pecl 扩展 geoip PHP 5.3。
我想搜索我作为参数的IP地址的国家,而不是查询我自己的IP地址。
谢谢
how can i query the geoip database using php?
I have apache2 with mod_geoip2 installed and the pecl extension geoip PHP 5.3.
i want to search the country of the ip address i have as a parameter, not to query my own ip address.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想
geoip_country_code_by_name
函数可以做到这一点:它接受主机名或 IP 地址作为参数,并返回相应的国家/地区代码。如果您传递该参数的 IP 地址(而不是您自己的),它应该会执行您所要求的操作。
I suppose the
geoip_country_code_by_name
function could do the trick : it takes a hostname or IP address as a parameter, and returns the corresponding country-code.If you pass the IP address you have for that parameter (and not your own), it should do what you're asking for.