Country name from an Ip address with free IP geolocation webservice

我只是一个虾纸丫 提交于 2019-12-03 09:04:07

http://www.maxmind.com/app/php

You need to install the php module and then use the following code to get the country name:

$country_name = apache_note("GEOIP_COUNTRY_NAME");

geoip_country_code_by_name can give you the country for an arbitrary IP address or hostname (not just the one from the current visitor as apache_note("GEOIP_COUNTRY_NAME") does), it uses the same MaxMind database. There is also the geoip_country_name_by_name function if you want the full country name rather than the ISO code.

Have checked this functionality in Oplim? It is free for up to 500k pageviews, and you can set your code and custom condition (country, or even areas such as all the EU).

Disclosure: I am among the service developers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!