views:

55

answers:

2

Hi,

I'm woking on a PHP app that should show visitors in a world map, base on their ip-addresses.

Have you tried/used any geo-information library in PHP? Something that can convert ip-addresses into geo-information? If so, please share your experience and recommendations.

+2  A: 

How about Geo IP? http://us.php.net/manual/en/book.geoip.php

tandu
have you used it? how accurate it is?
fast-dev
I have only used it to identify countries. When visitors come to sign up, their country is auto-selected for them based on geoip. I tested it out by comparing their web session IP with their account and it has had about a 98% success rate checking about 20,000 entries, so it is probably good for countries. If you want to get more specific, not so sure though.
tandu
+1  A: 

Reading from the Google Map Documentation:

As a user's IP address can only provide a rough estimate of a user's location, we don't recommend using this approach for geolocation. The W3C approach is the easiest and most fully-supported so it should be prioritized over other methods.

Currently, several ways exist to detect the user's location within a browser. None of these methods are part of the Google Maps API; instead, they are common industry standards. Newer browsers are starting to support the W3C Geolocation standard. This standard is part of HTML5 and will likely become the de-facto standard going forward. All applications that wish to perform geolocation should support this standard. Some browsers with Google Gears can use Google Gears Geolocation API. Since widespread support for the W3C standard is still forthcoming, checking for Gears is a good fallback mechanism. Some browsers use IP addresses to detect a user's location, though this provides only a very rough estimate.

Roberto Aloi
very interesting. The W3C approach will be the way to go in the future. I need something that works now, that's why I;m trying o fins what other developers are using now and how well it's performing. Thanks for this info!
fast-dev
Yep, I realize your pain :) Good luck with your search. Interesting question, btw.
Roberto Aloi