Location: PHPKode > scripts > phpIP2Country > phpip2country/test.ip2country.class.php
<?php
/*
This is the test example for phpIP2Country

getIPData() returns an array from the IP2Country table for the given IPV4 address

*/

include('database.class.php');
include('ip2country.class.php');

$db = new phpDB(array('type' => 'MySQL', 'host' => '127.0.0.1', 'username' => 'root', 'password' => '', 'database' => 'ip2country'));
$db->connect();
$db->selectDatabase();

$IP2Country = new phpIP2Country(array('db' => &$db));
print_r($IP2Country->getIPData('81.6.251.77'));

//google.co.uk
print_r($IP2Country->getIPData('64.233.187.99'));

//phpclasses.org
print_r($IP2Country->getIPData('69.55.226.116'));

?>
Return current item: phpIP2Country