Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

geoip(3) [debian man page]

geoip(3)							    Version 0.2 							  geoip(3)

NAME
geoip - A Tcl extension for geographic or organisational lookup of IP addresses and hostnames. SYNOPSIS
geoip open [-type TYPE ] [-flags FLAG ] geoip open [-file PATH ] [-flags FLAG ] geoip [COMMAND] geoip [QUERY] arg1 DESCRIPTION
This Tcl extension encapsulates most of GeoIP C API functions into tcl commands. OPEN OPTIONS
open takes either a file path and a set of flags, or a type and a set of flags. Supported types and flags are described below. TYPE Looks under the standard installation share directory, eg /usr/local/share/GeoIP/ for a GeoIP database according to type. PATH Absolute/relative path to GeoIP database. FLAG Flags seperated by ':', eg memory_cache:memory_check COMMAND
Individual singular commands can be one of: close Close the currently open database. db_info Get information about the current database. db_edition Returns edition of opened database. db_avail Test the availability of databases in your system in known locations. e.g db_avail country_edition QUERY
Commands that query the database. All commands return N/A if a result cannot be found. If none already open, a command will attempt to open a suitable database. country commands will open a country_edition database. region commands will open a region_edition_rev1 one. name com- mands will open an org_edition one, and the record_edition will open a city_edition_rev1 database. The commands are: country_code_by_addr Takes an IP address and returns the ISO-3166-1 Alpha-2 code of the country. country_code3_by_addr Takes an IP address and returns the ISO-3166-1 Alpha-3 code the country. country_code_by_name Takes a hostname and returns the ISO-3166-1 Alpha-2 code the country. country_code3_by_name Takes a hostname and returns the ISO-3166-1 Alpha-3 code the country. country_name_by_addr Takes an IP address and returns the country name. country_name_by_name Takes a hostname and returns the country name. name_by_addr Takes an IP address and returns the organisation name (or ISP/ASnum according to the opened database) name_by_name Takes a hostname and returns the organisation name. region_by_addr Takes an IP address and returns these region attributes as in an associative array: country, region region_by_name Takes a hostname and returns the region attributes. record_by_addr Takes an IP address and returns these record attributes as in an associative array: code, code3, region, country, city, postcode, latitude, longitude, dma(dma code), and area (area code) record_by_name Takes a hostname and returns the record attributes. TYPES
Relevant types of databases are: country_edition, org_edition, isp_edition, city_edition_rev1, region_edition_rev1, geoip_asnum_edition. "open -type" will accept their unambiguous abbreviations. FLAGS
Valid flags are: standard, memory_cache, check_cache, index_cache. FILES
./share/GeoIP.dat GeoIP country_edition database. ./share/GeoIPOrg.dat GeoIP org_edition database. ./share/GeoIPCity.dat GeoIP region_city_rev1 database. ./share/GeoIPRegion.dat GeoIP region_edition_rev1 database. ./share/GeoIPASNum.dat GeoIP asnum_edition database. BUGS
Please report to author. AUTHOR
Djihed Afifi <djihed@gmail.com>. SEE ALSO
GeoIP C API documentation <www.maxmind.com> Tcl extension April 2007 geoip(3)

Check Out this Related Man Page

GEOIP_RECORD_BY_NAME(3) 						 1						   GEOIP_RECORD_BY_NAME(3)

geoip_record_by_name - Returns the detailed City information found in the GeoIP Database

SYNOPSIS
array geoip_record_by_name (string $hostname) DESCRIPTION
The geoip_record_by_name(3) function will return the record information corresponding to a hostname or an IP address. This function is available for both GeoLite City Edition and commercial GeoIP City Edition. A warning will be issued if the proper data- base cannot be located. The names of the different keys of the returning associative array are as follows: o "continent_code" -- Two letter continent code (as of version 1.0.4 with libgeoip 1.4.3 or newer) o "country_code" -- Two letter country code (see geoip_country_code_by_name(3)) o "country_code3" -- Three letter country code (see geoip_country_code3_by_name(3)) o "country_name" -- The country name (see geoip_country_name_by_name(3)) o "region" -- The region code (ex: CA for California) o "city" -- The city. o "postal_code" -- The Postal Code, FSA or Zip Code. o "latitude" -- The Latitude as signed double. o "longitude" -- The Longitude as signed double. o "dma_code" -- Designated Market Area code (USA and Canada only) o "area_code" -- The PSTN area code (ex: 212) PARAMETERS
o $hostname - The hostname or IP address whose record is to be looked-up. RETURN VALUES
Returns the associative array on success, or FALSE if the address cannot be found in the database. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 1.0.4 | | | | | | | Adding the continent_code with GeoIP Library | | | 1.4.3 or newer only | | | | | 1.0.3 | | | | | | | Adding country_code3 and country_name | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A geoip_record_by_name(3) example This will print the array containing the record of host example.com. <?php $record = geoip_record_by_name('www.example.com'); if ($record) { print_r($record); } ?> The above example will output: Array ( [continent_code] => NA [country_code] => US [country_code3] => USA [country_name] => United States [region] => CA [city] => Marina Del Rey [postal_code] => [latitude] => 33.9776992798 [longitude] => -118.435096741 [dma_code] => 803 [area_code] => 310 ) PHP Documentation Group GEOIP_RECORD_BY_NAME(3)
Man Page