PHP Classes

File: test.ip2country.class.php

Recommend this page to a friend!
  Classes of Mike Leigh  >  phpIP2Country  >  test.ip2country.class.php  >  Download  
File: test.ip2country.class.php
Role: Example script
Content type: text/plain
Description: Example Usage
Class: phpIP2Country
Determine the country of an IP in a database
Author: By
Last change:
Date: 16 years ago
Size: 642 bytes
 

Contents

Class file image Download
<?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'));

?>

For more information send a message to info at phpclasses dot org.