geo-ip
Posted: Mon Oct 20, 2014 9:25 pm
found this while researching some for new functionality for my web sites
http://php.net/manual/en/book.geoip.php
what I was looking to do is recognize certain markets and tweak ads for location aware
I have code now to supply hostname from a page I made earlier
http://php.net/manual/en/book.geoip.php
what I was looking to do is recognize certain markets and tweak ads for location aware
Code: Select all
string geoip_country_code_by_name ( string $hostname )Code: Select all
<?php
echo ' Client IP address: ';
if ( isset($_SERVER["REMOTE_ADDR"]) ) {
echo '' . $_SERVER["REMOTE_ADDR"] . ' ';
} else if ( isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ) {
echo '' . $_SERVER["HTTP_X_FORWARDED_FOR"] . ' ';
} else if ( isset($_SERVER["HTTP_CLIENT_IP"]) ) {
echo '' . $_SERVER["HTTP_CLIENT_IP"] . ' ';
}
?>