geoip
Get Version
0.8.1→ ‘Geographic info for an IP address’
What
GeoIP searches a GeoIP database for a given host or IP address, and
returns information about the country where the IP address is allocated.
Installing
sudo gem install geoip
Prerequisites
You need at least the free GeoIP.dat, for which the last known download
location is http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
This API requires the file to be decompressed for searching. Other versions
of this database are available for purchase which contain more detailed
information, but this information is not returned by this implementation.
See www.maxmind.com for more information.
Example
require ‘geoip’ GeoIP.new(‘GeoIP.dat’).country(“www.netscape.sk”) => [“www.netscape.sk”, “217.67.16.35”, 196, “SK”, “SVK”, “Slovakia”, “EU”]How to submit patches
Read the 8 steps for fixing other people’s code and for section 8z: Submit patch, email me on the link below.
The trunk repository is svn://rubyforge.org/var/svn/geoip/trunk
for anonymous access.
Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.
License
This code is free to use under the terms of the GPL license.
I don’t normally use the GPL license, but this one is derived
from Maxmind’s code, so I use the license they use.
Contact
Comments are welcome. Send an email to Clifford Heath .
Clifford Heath, 25th May 2009
Theme extended from Paul Battley