1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<?
require_once "Net/GeoIP.php";

$geoip = Net_GeoIP::getInstance("./GeoIP.dat");

    echo $_SERVER['REMOTE_ADDR']."<br>";
try {
    echo $geoip->lookupCountryName($_SERVER['REMOTE_ADDR']);
} catch (Exception $e) {
    // Handle exception
    echo "exception";
}

?>