How to find the city using IP address?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vani sri
Forum Commoner
Posts: 28
Joined: Fri Apr 25, 2008 12:20 am

How to find the city using IP address?

Post by vani sri »

Hi all,

It got the Ip Address as 122.164.81.242 . How to find the city name using this IP address?

Thanks & regards,
vani
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: How to find the city using IP address?

Post by onion2k »

Pop over to Maxmind.com and buy the list ... http://www.maxmind.com/app/city It's not completely fool-proof. It works best for cities in the USA really. Other countries aren't that accurate.

EDIT: Just noticed they now have a free version of the city database - http://www.maxmind.com/app/geolitecity
vani sri
Forum Commoner
Posts: 28
Joined: Fri Apr 25, 2008 12:20 am

Re: How to find the city using IP address?

Post by vani sri »

HI thanks for your reply.

I want to track the city using PHP functions. Is it possible?? ???
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: How to find the city using IP address?

Post by onion2k »

vani sri wrote:I want to track the city using PHP functions. Is it possible?? ???
Yes. Use the database I linked to.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: How to find the city using IP address?

Post by Kieran Huggins »

What you're looking for is IP geolocation - there was a thread on here a few days ago.
Post Reply