What PHP geo-information library can you recommend? [closed]
I'm woking on a PHP a开发者_开发百科pp 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.
How about Geo IP? http://us.php.net/manual/en/book.geoip.php
This library has some providers that have IP based geocoding interfaces: https://github.com/willdurand/Geocoder
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.
More...
For my visitor map, I setup a Google Fusion table. I do the MaxMind lookup and add the date, time, IP, lat., and lon. to the table using PHP. Fusion tables can do mapping in the GUI and the new Google Maps V3 API supports passing a Fusion Table ID and SELECT query so the map draws using your specifications. I made my main database private and then created a public view that only displays lat and long so that the Google Maps API does not need to authenticate with Google to draw the map.
I use it to make the visitor map on my website. I just implemented the visitor map this week. I have all of the code packaged up so that it can be deployed on nearly any server that supports PHP and CURL. Soot me an email to jkirby(at)drinkcocaine(dot)com if you are interested.
You can see my map at www(dot)drinkcocaine.c(dot)com.
I have been using http://www.maxmind.com for over a year now and I am very pleased. It can locate down to the city for free. It can works it's way down even closer and report ISP and organization data if you pay for the service. I pay for the service. I paid for 500K lookups and I still have like 365K left (after almost two years now). I use it for visitor mapping in conjunction with Google maps. It takes about 10 lines (or less) of PHP code to make the query and get information back.
You can also download the free databases and use them on your server (updates available each month). They come with all the PHP code required to do the lookups. You can also install the paid version locally.
I wish there was a $_SERVER[W3C_LOCATION]
do-hicky :)
精彩评论