GeoIP Example

We install GeoIP modules on all of our servers and keep the database as up to date as possible. 

The below output should show something like the below.

Country Code: NZ
Country: New Zealand
Continent Code: OC

<?php
$GEOIP_COUNTRY_CODE = $_SERVER['GEOIP_COUNTRY_CODE'];
print "Country Code: " . $GEOIP_COUNTRY_CODE;
echo "<BR>";
$GEOIP_COUNTRY_NAME = $_SERVER['GEOIP_COUNTRY_NAME'];
print "Country: " . $GEOIP_COUNTRY_NAME;
echo "<BR>";
$CONTINENT_COD = $_SERVER['GEOIP_CONTINENT_CODE'];
print "Continent Code: " . $CONTINENT_COD;
?>

Was this answer helpful?

 Print this Article