Net_GeoIP::lookupRegion() – returns the region for given IP address.


require_once "Net/GeoIP.php";

array lookupRegion() ( string $addr )


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.

Looking up the region

require_once "Net/GeoIP.php";

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

try {
$country_code$region) = $geoip->lookupRegion($_SERVER['REMOTE_ADDR']);
} catch (
Exception $e) {
// Handle exception


  • string $addr - IP address

    Note: Hostnames are not supported. More information.


This method throws an exception if the IP address is invalid.

Net_GeoIP::lookupCountryCode() (Previous) Net_GeoIP::lookupLocation() (Next)
Last updated: Tue, 02 Jun 2009 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.