Problem getting real IP in php
<p>I am using this to get real IP but I take empty from <code>$_SERVER['HTTP_CLIENT_IP']</code>, I take not empty only from <code>$_SERVER['REMOTE_ADDR']</code> .But I dont need the IP of proxy, I need the real ip of computers using some intranet. Can I get it? When <code>$_SERVER['HTTP_CLIENT_IP']</code> does not return empty?</p>

<pre><code>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;
}
</code></pre>
