Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GeoIP and IP to Country in PHP [duplicate]

Tags:

php

geoip

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 ?

like image 343
David Tkachuk Avatar asked Nov 16 '12 21:11

David Tkachuk


2 Answers

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

like image 92
Anthony Hatzopoulos Avatar answered Sep 26 '22 19:09

Anthony Hatzopoulos


Google is your best friend :).

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

https://ipstack.com/

like image 41
Stefan Koenen Avatar answered Sep 22 '22 19:09

Stefan Koenen