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 — Lit de code de continent d'une IP
Description
string geoip_continent_code_by_name
( string
$hostname
)geoip_continent_code_by_name() retourne le code en deux lettre du continenant corresopndant à un nom d'hôte ou une adresse IP.
Liste de paramètres
-
hostname -
Le nom d'hôte ou l'adresse IP qui est étudiée.
Valeurs de retour
Retourne le code en deux lettre du nom de continent, en cas de succès,
et FALSE si l'adresse n'a pas pu être trouvée dans la base.
Exemples
Exemple #1 Exemple avec geoip_continent_code_by_name()
Ce script va afficher le continent de l'hôte example.com.
<?php
$continent = geoip_continent_code_by_name('www.example.com');
if ($continent) {
echo 'Cet hôte est situé en : ' . $continent;
}
?>
L'exemple ci-dessus va afficher :
Cet hôte est situé en : 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.
