Get Started With IP2Proxy Perl Module

Dependencies

This library requires IP2Proxy BIN database to function. You may download the BIN database at


Installation

  1. Download IP2Proxy Perl module Geo-IP2Proxy-[version].tar.gz.

  2. Decompress the module.

    tar -xvfz Geo-IP2Proxy-x.xx.tar.gz
  3. Install Geo::IP2Proxy module.

    perl Makefile.PL
    make
    make test
    make install
    

Sample Codes

Query geolocation information from BIN database

You can query the geolocation information from the IP2Proxy BIN database as below:

use Geo::IP2Proxy;

eval {

	my $obj = Geo::IP2Proxy->open("IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL-PROVIDER-FRAUDSCORE.BIN");

	if (!defined($obj)) {
		print STDERR Geo::IP2Proxy::get_last_error_message();
	}

	my $packageversion = $obj->getPackageVersion();
	my $dbversion = $obj->getDatabaseVersion();
	my $moduleversion = $obj->getModuleVersion();
	my $countryshort = $obj->getCountryShort("1.2.3.4");
	my $countrylong = $obj->getCountryLong("1.2.3.4");
	my $region = $obj->getRegion("1.2.3.4");
	my $city = $obj->getCity("1.2.3.4");
	my $isp = $obj->getISP("1.2.3.4");
	my $domain = $obj->getDomain("1.2.3.4");
	my $usagetype = $obj->getUsageType("1.2.3.4");
	my $asn = $obj->getASN("1.2.3.4");
	my $as = $obj->getAS("1.2.3.4");
	my $lastseen = $obj->getLastSeen("1.2.3.4");
	my $threat = $obj->getThreat("1.2.3.4");
	my $proxytype = $obj->getProxyType("1.2.3.4");
	my $provider = $obj->getProvider("1.2.3.4");
	my $fraudscore = $obj->getFraudScore("1.2.3.4");
	my $isproxy = $obj->isProxy("1.2.3.4");

	($isproxy, $proxytype, $coshort, $colong, $region, $city, $isp, $domain, $usagetype, $asn, $as, $lastseen, $threat, $provider, $fraudScore) = $obj->getAll("1.2.3.4");
	($isproxy, $proxytype, $coshort, $colong, $region, $city, $isp, $domain, $usagetype, $asn, $as, $lastseen, $threat, $provider, $fraudScore) = $obj->getAll("2001:0000:0000:0000:0000:0000:0000:0000");

	$obj->close();

} or do {

	print STDERR Geo::IP2Proxy::get_last_error_message();

};

IP2Proxy Sample Database (BIN)

Sample Packages - BIN File IPv4 + IPv6
IP2Proxy PX1 Download (391.66 kB)
IP2Proxy PX2 Download (406.53 kB)
IP2Proxy PX3 Download (435.82 kB)
IP2Proxy PX4 Download (471.49 kB)
IP2Proxy PX5 Download (491.37 kB)
IP2Proxy PX6 Download (493.92 kB)
IP2Proxy PX7 Download (534.57 kB)
IP2Proxy PX8 Download (540.70 kB)
IP2Proxy PX9 Download (541.56 kB)
IP2Proxy PX10 Download (677.91 kB)
IP2Proxy PX11 Download (684.40 kB)
IP2Proxy PX12 Download (687.12 kB)