GeoIP and IP to Country in PHP [duplicate]

2019-05-09 12:51发布

Possible Duplicate:
How to get the page visitors Country with PHP?

I've been searching everywhere, and I can't seem to find anything. I need a free PHP GeoIP/Ip to country.

All I can find is that it gives me the country and small form of the country. I also would like to have information of possible street or coords, city, and maybe host information?

I need this because I am creating a PHP CMS (for myself and clients) and I want to track ips.

I don't really want an API, I want it like a database. Any ideas ?

标签: php geoip
2条回答
Evening l夕情丶
2楼-- · 2019-05-09 13:26

MaxMind GeoLite database: http://dev.maxmind.com/geoip/geolite OR pay for the full version: http://www.maxmind.com/en/geolocation_landing

They also have php libraries to go with it: http://dev.maxmind.com/geoip/downloadable

As for PHP, checkout GeoIP library and Example geoip_record_by_name()

For a database, you could make your own database overtime... and fill it with cached collected data but I doubt that would be as accurate as MaxMind's data.

There are many other methods you could use and couple them with a custom database or even combine it with the GeoLite db: geoplugin, ipinfodb

查看更多
做个烂人
3楼-- · 2019-05-09 13:48

Google is your best friend :).

you should be able to make it yourself with this information (API):

https://ipstack.com/

查看更多
登录 后发表回答