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

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

Net_Geo - 例

Net_Geo - 例 -- リモートクライアントの IP を調べる


<?php

require_once('Net/Geo.php');

// Net_Geo オブジェクトを生成する
$net_geo = new Net_Geo();

// クライアントの IP アドレスを取得する
$ip $_SERVER['REMOTE_ADDR'];

// net_geo からの情報を配列として取得する
$results $net_geo->getRecord($ip);

// 出力
echo "単一 IP の結果:<br />";
echo "<pre>";
print_r($results);
echo "</pre>";

// 複数 IP を配列形式で扱う例
$arr_ips = array
(
  gethostbyname("www.google.com"),
  gethostbyname("www.heise.de"),
  gethostbyname("www.college.ch")
);

// net_geo からの情報を配列として取得する
$results $net_geo->getRecord($arr_ips);

// 出力
echo "複数 IP の結果:<br />";
echo "<pre>";
print_r($results);
echo "</pre>";

?>

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

Download Documentation Last updated: Sun, 05 Oct 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.