My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

PHP extension for libip2c - IP to country resolving library http://code.google.com/p/libip2c/

Sample code:

<?php

$ips = array(
	_ip2long('209.85.149.99'),
	_ip2long('204.152.191.37'),
	_ip2long('89.111.13.45'),
);

function _ip2long($ip)
{
	return sprintf("%u", ip2long($ip));
} // _ip2long

$codes = ip2c_getcountry($ips);

print_r($codes);

Output:

 Array
 (
     [0] => US
     [1] => US
     [2] => LV
 )
 

Powered by Google Project Hosting