How to get ip address of client.
I have checked through proxy REMOTE_ADDR,HTTP_X_FORWARDED_FOR but both not giving me correct ip
REMOTE_ADDR_IP is not working.
How to get ip address of client.
I have checked through proxy REMOTE_ADDR,HTTP_X_FORWARDED_FOR but both not giving me correct ip
REMOTE_ADDR_IP is not working.
 
    
    I use the most reliable function I've found long ago
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;
}
