PHP is open source scripting language. It\'s widely used to develop web applications.  Home Web Programming PHP Get Hostname Behind Proxies

Get Hostname Behind Proxies


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;
?>


Author's URL: Andrew Makowsky
PHP is open source scripting language. It\'s widely used to develop web applications. More PHP Tutorials: Featured Materials | Fresh Materials | More PHP Tutorials at LearnPHP.org

No comments yet...
Add comments to "Get Hostname Behind Proxies"

Captcha