Path: | lib/geoip.rb |
Last Update: | Tue May 21 00:24:43 +0000 2013 |
Native Ruby reader for the GeoIP database Lookup the country where IP address is allocated
This version Copyright (C) 2005 Clifford Heath Derived from the C version, Copyright (C) 2003 MaxMind LLC
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
require 'geoip' p GeoIP.new('/usr/share/GeoIP/GeoIP.dat').country("www.netscape.sk")
GeoIP searches a GeoIP database for a given host or IP address, and returns information about the country where the IP address is allocated.
You need at least the free GeoIP.dat, for which the last known download location is <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.