views:

453

answers:

6

Heyy guys

I wanted to check if anyone knows of a reliable API that we can use to determine the user's city and country from his IP address.

My search on Google led to http://ipinfodb.com/ip_location_api.php

It seems perfect but my only concern is the reliability of this service. Does google have anything like this. If you know any other Free or paid API's that help determine user's location from his IP - please let me know

THanks

+2  A: 

I've used http://www.hostip.info/ and found it really good.

codaddict
Thanks codaddict - let me check that out
Gublooo
A: 

Every IP geolocation depends on records submitted by the ISP. This will never be completely reliable because many ISPs submit location of their office instead of physical locations of their subnets which may be in a different city or even country.

SF.
Thanks SF - I probably used the wrong term - when I meant reliable - I meant to say the service should be quick and not have much down time. I understand we can never 100% correctly determine the location. This is just to prefill the form for the user which he can then change it if the city/country is wrong
Gublooo
+1  A: 

In a sense, you can't reliably know the location of a user. Using the tips the other answers provide will give you the geolocation of an IP, but there's no way to know that that IP address in New York USA isn't being accessed through a VPN from someone on a business trip to London, UK, or whether someone's using an anonymizing service like Tor.

Frank Shearar
Thanks Frank - I probably used the wrong term - when I meant reliable - I meant to say the service should be quick and not have much down time. I understand we can never 100% correctly determine the location. This is just to prefill the form for the user which he can then change it if the city/country is wrong
Gublooo
+1  A: 

MaxMind has a lite version of their ip2country and ip2city databases: http://www.maxmind.com/app/geolitecity

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

If you don't mind hosting the database yourself, it's free. The paid services are more accurate.

They also provides web services for querying, but it is not free: http://www.maxmind.com/app/web_services#country

Kjetil Watnedal
A: 

You can find your city, longitude, latitude and ISP and many other geo-location information via IP address. I am using database from www.ip2location.com and it suits my need and requirement.

babidor