w3-tools.com - Free Webmaster Tools and Resources
 
w3-tools.com - Free Webmaster Tools and Resources
 Free Webmaster Tools and Resources

 



PEAR Manual

This manual is provided as a courtesy. It is not an official source. Please check pear.php.net for updated information.

PEAR Manual

PEAR Manual

Net_Geo - Example

Net_Geo - Example -- tracking down the remote client IP

Example

<?php

require_once('Net/Geo.php');

// new Net_Geo object
$net_geo = new Net_Geo();

// fetch the client's IP
$ip = $_SERVER['REMOTE_ADDR'];

// fetch information array from net_geo
$results = $net_geo->getRecord($ip);

// output
echo "Single IP results:<br />";
echo "<pre>";
print_r($results);
echo "</pre>";

// example array of multiple IPs
$arr_ips = array
(
  gethostbyname("www.google.com"),
  gethostbyname("www.heise.de"),
  gethostbyname("www.college.ch")
);

// fetch information array from net_geo
$results = $net_geo->getRecord($arr_ips);

// output
echo "Multiple IP results:<br />";
echo "<pre>";
print_r($results);
echo "</pre>";

?>

Newsletter

Join to our newsletter and receive news and updates about our site.
Your name: 
E-mail address: 
Action: 
 

Hosted by

Search

Google
Web w3-tools.com

Links

  What is my IP? Find your IP address!     Valid XHTML 1.0 Transitional  
Copyright © 2006. by w3-tools.com. All rights reserved