IP2Location > Geo-IP2Location-4.00 > Geo::IP2Location

Download:
Geo-IP2Location-4.00.tar.gz

Dependencies

Annotate this POD (1)

Related Modules

Net::DNS
NetAddr::IP
Net::Patricia
Nmap::Scanner
Data::Dumper
more...
By perlmonks.org

CPAN RT

New  4
Open  0
View/Report Bugs
Module Version: 4.00   Source  

NAME ^

Geo::IP2Location - Fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code and station, MCC, MNC and mobile carrier brand 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-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE.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");
        my $timezone = $obj->get_timezone("20.11.187.239");
        my $netspeed = $obj->get_netspeed("20.11.187.239");
        my $iddcode = $obj->get_iddcode("20.11.187.239");
        my $areacode = $obj->get_areacode("20.11.187.239");
        my $weatherstationcode = $obj->get_weatherstationcode("20.11.187.239");
        my $weatherstationname = $obj->get_weatherstationname("20.11.187.239");
        my $mcc = $obj->get_mcc("20.11.187.239");
        my $mnc = $obj->get_mnc("20.11.187.239");
        my $brand = $obj->get_mobilebrand("20.11.187.239");

        ($cos, $col, $reg, $cit, $lat, $lon, $zip, $tmz, $isp, $dom, $ns, $idd, $area, $wcode, $wname, $mcc, $mnc, $brand) = $obj->get_all("20.11.187.239");
        ($cos, $col, $reg, $cit, $lat, $lon, $zip, $tmz, $isp, $dom, $ns, $idd, $area, $wcode, $wname, $mcc, $mnc, $brand) = $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, connection type, IDD code, area code, weather station code and station, MCC, MNC and mobile carrier brand name 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.

$idd = $obj->get_iddcode( $ip );

Returns the country IDD calling code for an IP address or domain name.

$area = $obj->get_areacode( $ip );

Returns the phone area code code for an IP address or domain name.

$wcode = $obj->get_weatherstationcode( $ip );

Returns the nearest weather station code for an IP address or domain name.

$wname = $obj->get_weatherstationname( $ip );

Returns the nearest weather station name for an IP address or domain name.

$mcc = $obj->get_mcc( $ip );

Returns the mobile carrier code (MCC) for an IP address or domain name.

$mnc = $obj->get_mnc( $ip );

Returns the mobile network code (MNC) for an IP address or domain name.

$brand = $obj->get_mobilebrand( $ip );

Returns the mobile carrier brand for an IP address or domain name.

($cos, $col, $reg, $cit, $lat, $lon, $zip, $tmz, $isp, $dom, $ns, $idd, $area, $wcode, $wname, $mcc, $mnc, $brand) = $obj->get_all( $ip );

Returns an array of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection type, IDD code, area code, weather station code and station, MCC, MNC and mobile carrier brand 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 ^

4.00

AUTHOR ^

Copyright (c) 2010 IP2Location.com

All rights reserved. This package is free software; It is licensed under the GPL.

syntax highlighting: