website promotion banner
eturnkeys
Your Ad Here
Web Programming  Home Web Programming PHP Get Hostname Behind Proxies
rss

Get Hostname Behind Proxies

Author: Andrew Makowsky More by this author


Get Hostname Behind Proxies This is a very simple code and works for anybody who is behind proxies and people who are not. This might be usfull if your have cable users visiting your site.

<?php $ip = getenv('REMOTE_HOST');
if(!$ip) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
if(!$ip) {
$ip = $HTTP_X_FORWARDED_FOR;
}
if(!$ip) {
$ip = getenv('REMOTE_ADDR');
}
if(!$ip) {
$ip = $REMOTE_ADDR;
}
$ip = @GetHostByAddr($ip);
echo $ip;
?>


Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Get Hostname Behind Proxies"