Net_Geo (Previous) (Next) Net_Geo::Net_Geo()

View this page in Last updated: Sun, 28 Sep 2008
English | French | German | Hungarian | Japanese | Polish | Spanish | Plain HTML

Net_Geo - Exemple

Net_Geo - Exemple -- traquer l'I.P. d'un client

Exemple


<?php

require_once('Net/Geo.php');

// création de l'objet net_geo
$net_geo = new Net_Geo();

// récupère l'I.P. du client
$ip $_SERVER['REMOTE_ADDR'];

// récupère dans net_geo le tableau contenant l'information
$resultat $net_geo->getRecord($ip);

// affichage
echo "Résultat pour une simple I.P.:<br />";
echo "<pre>";
print_r($resultat);
echo "</pre>";

// exemple de tableau de plusieurs I.P.
$tableau_ips = array
(
  gethostbyname("pear.php.net"),
  gethostbyname("be.php.net"),
  gethostbyname("nl.php.net")
);

// récupère le tableau contenant l'information dans net_geo
$resultat $net_geo->getRecord($tableau_ips);

// affichage
echo "Résultat pour plusieurs IP :<br />";
echo "<pre>";
print_r($resultat);
echo "</pre>";

?>

Net_Geo (Previous) (Next) Net_Geo::Net_Geo()

Download Documentation Last updated: Sun, 28 Sep 2008
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
Note by: haptiK@gmail.com
Unfortunatly most results returned are so far off the mark it deems the package entirely useless.