mod_geoip2 和 php pecl-geoip:如何通过 ip 地址查询?

发布于 2024-08-23 04:28:05 字数 140 浏览 7 评论 0原文

如何使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撩起发的微风 2024-08-30 04:28:06

我想 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文