I am using this to get real IP but I take empty from $_SERVER['HTTP_CLIENT_IP'], I take not empty only from $_SERVER['REMOTE_ADDR'] .But I dont need the IP of proxy, I need the real ip of computers using some intranet. Can I get it? When $_SERVER['HTTP_CLIENT_IP'] does not return empty?
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}