View Full Version : geo ip address and php
mortpig
Jun 6th 2004, 8:13 pm
hi i want to be able to check via php whether a visitor is based in the USA or not, does anybody have any good resources i could look into ?
digitalpoint
Jun 6th 2004, 8:42 pm
Do you have a geotargetting database yet?
mortpig
Jun 6th 2004, 8:54 pm
do u need one ?
i was hoping all it was built into php.
So u need to cross-reference the ip adress against a database of where that ip exists ?
this cant be done in realtime at all ?
digitalpoint
Jun 6th 2004, 8:58 pm
It can be done in realtime, but it does require a large database.
mortpig
Jun 6th 2004, 9:08 pm
how does one get their hands on a database ?
digitalpoint
Jun 6th 2004, 9:09 pm
They usually can be found for sale. Search Google for one, and I bet you get a ton of AdSense ads for them.
sarahk
Jun 7th 2004, 1:12 am
I use a free database from http://ip-to-country.webhosting.info/
It is large but if you're only interested in the USA then you could delete all the non usa records and then just find out if the record exists or not.
quick and easy.
it does require regular updates but isn't onerous.
Sarah
nlopes
Jun 7th 2004, 1:14 am
I use that, too, with PHP and mysql.
Check it at work at: http://testes.aborla.net/ip.php
vinyl
Jun 7th 2004, 4:25 pm
www.ip2nation.com
nlopes
Jun 8th 2004, 1:34 am
the ip2nation DB isn't very good, IMHO....
vinyl
Jun 8th 2004, 7:39 am
you say that based on what? i am also from europe, and site where i am using it is targetting europian countres and i never saw any problems... but that doesnt mean that there might be some. id really like to hear more from you... do you use the latest db?
nlopes
Jun 8th 2004, 7:47 am
I've never used such DB :) I've just take a look into it!!
As it doesn't use delimeters for IPs, it is more likely to generate false positives.
But if you want I may set an url with both DBs to let people test and report here the differences :)
vinyl
Jun 8th 2004, 8:59 am
no, i dont want to bother you with practical tests...:)
zerostar07
Feb 2nd 2008, 11:14 am
great links guys, i was looking for that :)
mvl
Feb 3rd 2008, 11:17 am
Maxmind (http://www.maxmind.com) has great free databases (http://www.maxmind.com/app/geoip_country) for this. They also have code examples in PHP and several other programming languages. I personally prefer their paid webservices because they are always up to date and more accurate (Look at the url in my sig (http://getmyip.eu/) for an example). For your purposes the free database should be good enough.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.