previousNet_GeoIP::lookupCountryName() (Previous) (Next) Net_GeoIP::lookupRegion()next

View this page in Last updated: Sun, 21 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Net_GeoIP::lookupCountryCode()

Net_GeoIP::lookupCountryCode() – 指定した IP アドレスに対応する、2 文字の国コード (例: "CA") を返す

Synopsis

require_once "Net/GeoIP.php";

string lookupCountryCode() ( string $addr )

Description

このメソッドは、指定した IP アドレスに対応する 2 文字の国コードを返します。 フリー版、非フリー版のどちらのデータベースでも使用可能です。

国コードの検索

<?php
require_once "Net/GeoIP.php";

$geoip Net_GeoIP::getInstance("/path/to/geoipdb.dat");

try {
    echo 
$geoip->lookupCountryCode($_SERVER['REMOTE_ADDR']);
} catch (
Exception $e) {
    
// 例外処理
}
?>

Parameter

Throws

IP アドレスが無効な場合、あるいはデータベースの形式が不正な場合に このメソッドは例外をスローします。

previousNet_GeoIP::lookupCountryName() (Previous) (Next) Net_GeoIP::lookupRegion()next

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.