NAME
Geo::IP2Location - Fast lookup of country, region, city, latitude, longitude, ZIP code, ISP and domain name from IP address by using IP2Location database. Supports IPv4 and IPv6.
SYNOPSIS
use Geo::IP2Location;
my $obj = Geo::IP2Location->open("IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-ISP-DOMAIN.BIN");
my $dbversion = $obj->get_database_version();
my $moduleversion = $obj->get_module_version();
my $countryshort = $obj->get_country_short("20.11.187.239");
my $countrylong = $obj->get_country_long("20.11.187.239");
my $region = $obj->get_region("20.11.187.239");
my $city = $obj->get_city("20.11.187.239");
my $latitude = $obj->get_latitude("20.11.187.239");
my $longitude = $obj->get_longitude("20.11.187.239");
my $isp = $obj->get_isp("20.11.187.239");
my $domain = $obj->get_domain("20.11.187.239");
my $zipcode = $obj->get_zipcode("20.11.187.239");
($cos, $col, $reg, $cit, $lat, $lon, $zip, $isp, $dom) = $obj->get_all("20.11.187.239");
($cos, $col, $reg, $cit, $lat, $lon, $zip, $isp, $dom) = $obj->get_all("2001:1000:0000:0000:0000:0000:0000:0000");
DESCRIPTION
This Perl modules provide fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name and connection type from IP address by using IP2Location database. This module uses a file based database available at IP2Location.com. This database simply contains IP blocks as keys, and other information such as country, region, city, latitude, longitude, ISP and domain name as values. It supports both IP address in IPv4 and IPv6.
This module can be used in many types of projects such as:
1) select the geographically closest mirror
2) analyze your web server logs to determine the countries of your visitors
3) credit card fraud detection
4) software export controls
5) display native language and currency
6) prevent password sharing and abuse of service
7) geotargeting in advertisement
IP2LOCATION DATABASES
The complete IPv4 and IPv6 database are available at
http://www.ip2location.com
The database will be updated in monthly basis for greater accuracy. Free sample database is available at
http://www.ip2location.com/developers.htm
CLASS METHODS
- $obj = Geo::IP2Location->open($database_file);
-
Constructs a new Geo::IP2Location object with the database located at $database_file.
OBJECT METHODS
- $countryshort = $obj->get_country_short( $ip );
-
Returns the ISO 3166 country code for an IP address or domain name.
- $countrylong = $obj->get_country_long( $ip );
-
Returns the full country name for an IP address or domain name.
- $region = $obj->get_region( $ip );
-
Returns the region for an IP address or domain name.
- $city = $obj->get_city( $ip );
-
Returns the city for an IP address or domain name.
- $latitude = $obj->get_latitude( $ip );
-
Returns the latitude for an IP address or domain name.
- $longitude = $obj->get_longitude( $ip );
-
Returns the longitude for an IP address or domain name.
- $isp = $obj->get_isp( $ip );
-
Returns the ISP name for an IP address or domain name.
- $domain = $obj->get_domain( $ip );
-
Returns the domain name for an IP address or domain name.
- $zip = $obj->get_zipcode( $ip );
-
Returns the ZIP code for an IP address or domain name.
- $tz = $obj->get_timezone( $ip );
-
Returns the time zone for an IP address or domain name.
- $ns = $obj->get_netspeed( $ip );
-
Returns the connection type (DIAL, DSL or COMP) for an IP address or domain name.
- ($cos, $col, $reg, $cit, $lat, $lon, $zip, $tz, $isp, $dom, $ns) = $obj->get_all( $ip );
-
Returns an array of country short name, country long name, region, city, latitude, longitude and domain name for an IP address.
- $dbversion = $obj->get_database_version();
-
Returns the version number of database.
- $moduleversion = $obj->get_module_version();
-
Returns the version number of Perl module.
SEE ALSO
http://www.ip2location.com
VERSION
2.10
AUTHOR
Copyright (c) 2006 IP2Location.com
All rights reserved. This package is free software; It is licensed under the GPL.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 927:
You forgot a '=back' before '=head1'