test geo ip

A quick test to see if GeoIP is working on your web server:



What is my IP address and Country


<?

    if (getenv(HTTP_X_FORWARDED_FOR)) {
        $pipaddress = getenv(HTTP_X_FORWARDED_FOR);
        $ipaddress = getenv(REMOTE_ADDR);
        echo "Your Proxy IP address is : ".$pipaddress. " (via $ipaddress) " ;
    } else {
        $ipaddress = getenv(REMOTE_ADDR);
        echo "My IP address is : $ipaddress";
    }
    $country = getenv(GEOIP_COUNTRY_NAME);
    echo "
My Country : $country";
?>


Save the above code as geotest.php and upload to your web site, such as:
site_example.com/geotest.php

Of course, please replace site_example.com in the above example with your real domain name.

Posted in .

Leave a Reply