NAME

Geo::IP2Location - 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, mobile carrier brand name, elevation and usage type by using IP address. It supports both IPv4 and IPv6 addressing. Please visit IP2Location Database for more information.

SYNOPSIS

        use Geo::IP2Location;
        my $obj = Geo::IP2Location->open("IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE.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");
        my $elevation = $obj->get_elevation("20.11.187.239");
        my $usagetype = $obj->get_usagetype("20.11.187.239");

        ($cos, $col, $reg, $cit, $lat, $lon, $zip, $tmz, $isp, $dom, $ns, $idd, $area, $wcode, $wname, $mcc, $mnc, $brand, $elevation, $usagetype) = $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, $elevation, $usagetype) = $obj->get_all("2001:1000:0000:0000:0000:0000:0000:0000");

DESCRIPTION

This Perl module provides 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, mobile carrier brand, elevation and usage type from IP address using IP2Location database. This module uses a file based .BIN database available at http://www.ip2location.com upon subscription. This database contains IP blocks as keys and other information as values. It supports IP address in IPv4 or IPv6.

This module can be used in many types of project such as:

 1) auto-select the geographically closest mirror server
 2) analyze web server logs to determine the countries of 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:

IP2Location Product Page

The database will be updated in monthly basis for greater accuracy.

Free IP2Location LITE database is also available at:

IP2Location LITE Page

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 of IP address or domain name. Returns "-" for unassigned or private IP address.

$countrylong = $obj->get_country_long( $ip );

Returns the full country name of IP address or domain name. Returns "-" for unassigned or private IP address.

$region = $obj->get_region( $ip );

Returns the region of IP address or domain name.

$city = $obj->get_city( $ip );

Returns the city of IP address or domain name.

$latitude = $obj->get_latitude( $ip );

Returns the latitude of IP address or domain name.

$longitude = $obj->get_longitude( $ip );

Returns the longitude of IP address or domain name.

$isp = $obj->get_isp( $ip );

Returns the ISP name of IP address or domain name.

$domain = $obj->get_domain( $ip );

Returns the domain name of IP address or domain name.

$zip = $obj->get_zipcode( $ip );

Returns the ZIP code of IP address or domain name.

$tz = $obj->get_timezone( $ip );

Returns the time zone of IP address or domain name.

$ns = $obj->get_netspeed( $ip );

Returns the connection type (DIAL, DSL or COMP) of IP address or domain name.

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

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

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

Returns the phone area code code of IP address or domain name.

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

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

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

Returns the nearest weather station name of IP address or domain name.

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

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

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

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

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

Returns the mobile carrier brand of IP address or domain name.

$elevation = $obj->get_elevation( $ip );

Returns the elevation of IP address or domain name.

$usagetype = $obj->get_usagetype( $ip );

Returns the usage type of IP address or domain name.

($cos, $col, $reg, $cit, $lat, $lon, $zip, $tmz, $isp, $dom, $ns, $idd, $area, $wcode, $wname, $mcc, $mnc, $brand, $elevation, $usagetype) = $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, mobile carrier brand, elevation and usage type of 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

IP2Location Product Page

VERSION

8.04

AUTHOR

Copyright (c) 2017 IP2Location.com

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