Net_GeoIP::lookupRegion() --
returns the region for given IP address.
Opis
This method returns an array containing the country code and the
region for the specified IP address. It works only with a
non-free Region database.
Przykład 50-1.
Looking up the region
<?php
require_once "Net/GeoIP.php";
$geoip = Net_GeoIP::getInstance("/path/to/geoipdb.dat");
try {
list($country_code, $region) = $geoip->lookupRegion($_SERVER['REMOTE_ADDR']);
} catch (Exception $e) {
// Handle exception
}
?>
|
|
Wyjątki
This method throws an exception if the IP address is invalid.