See codes in the standard ISO 3166-1.
http://en.wikipedia.org/wiki/ISO_3166-1
geoip_continent_code_by_name
(PECL geoip >= 1.0.3)
geoip_continent_code_by_name — 二文字の大陸コードを取得する
説明
string geoip_continent_code_by_name
( string
$hostname
)geoip_continent_code_by_name() 関数は、 ホスト名あるいは IP アドレスに対応する二文字の大陸コードを返します。
パラメータ
-
hostname -
場所を探す対象となるホスト名あるいは IP アドレス。
返り値
成功した場合には二文字の大陸コード、
アドレスがデータベースで見つからない場合には FALSE を返します。
例
例1 geoip_continent_code_by_name() の例
これは、ホスト example.com がどこにあるのかを表示します。
<?php
$continent = geoip_continent_code_by_name('www.example.com');
if ($continent) {
echo 'This host is located in: ' . $continent;
}
?>
上の例の出力は以下となります。
This host is located in: NA
lord.rojer [at] gmail.com
01-Aug-2011 02:53
fabien dot snauwaert at gmail dot com
18-Jan-2010 04:40
The return values are not really documented anywhere in a straight-forward fashion.
The best I could find is a list of all countries and their associated continent codes, here: http://www.maxmind.com/app/country_continent
Leaving us with 7 possible continents:
AS for Asia
EU for Europe
SA for South America
AF for Africa
AN for µAntartica
OC for Oceania
NA for North America
As mentioned above, if the host/IP is not found in the database, the function returns FALSE.
