[nycphp-talk] Geoselect alternatives?
Andrew Yochum
andrew at plexpod.com
Sat Sep 24 00:30:22 EDT 2005
John,
On Fri, Sep 23, 2005 at 02:11:00PM -0700, inforequest wrote:
> What open source options are there to do what GeoSelect does? (resolve
> IP to City, State, Country, Lat, Long) server side in meory, with
> caching, perhaps placing the values in server vars like GeoSelect does?
> Maybe there is not yet a comprehensive (quality) IP to Geo database
> being maintained open source?
There wasn't that I was aware of until poking around a bit tonight...
I've used the perl Geo::IPfree module in the past, but can't speak to
the data's thoroughness or quality. I was interested in rough aggregate
quick and dirty stats at the time (a while back now), and I got this one
working very quickly. It only does IP->Country stuff, so not really
what you want.
http://search.cpan.org/~gmpassos/Geo-IPfree-0.2/lib/Geo/IPfree.pm
There are also seem various methods of accessing the freely available
MaxMind from within PHP now.
http://www.maxmind.com/app/php
http://www.maxmind.com/geoip/api/c.shtml
http://www.maxmind.com/download/geoip/database/
Also, only IP->Country - at least, in open source, that is. Including
their PEAR package for PHP 5 that seems to allow you to use their
commercial DB for more granular data:
http://pear.php.net/pepr/pepr-proposal-show.php?id=91
And in looking at that stuff just now I noticed right next door to it in
PEAR is the Net_Geo PEAR package which seems to maybe do just what you
want using CAIDA database:
http://pear.php.net/package/Net_Geo/
http://www.caida.org/
I just played around with it a bit and found it very easy to use, and
reasonably accurate in locating a few IPs I threw at it. It tells you
the granularity of the result, too. It makes a remote HTTP request to a
CGI on the CAIDA site and caches the results. Uncached queries
certainly lag a bit. It could do the trick depending on your needs.
HTH,
Andrew
--
Andrew Yochum
Plexpod
andrew at plexpod.com
718-360-0879
More information about the talk
mailing list