The best method to find client’s IP Address in PHP.

0 · Subin Siby · Jan. 5, 2013, 1:27 p.m.
Summary
This simple function will help you to find the client’s IP. You could use $_SERVER[‘REMOTE_ADDR’] , but this method will not returns the actual IP address. To get the real IP address use this method. function getUserIpAddr(){     if (!empty($_SERVER[‘HTTP_CLIENT_IP’])){         return $_SERVER[‘HTTP_CLIENT_IP’];     }else if (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])){         $ite=explode(‘,’,$_SERVER[‘HTTP_X_FORWARDED_FOR’]); return str_replace(" ",",$ite[0]);     }else{         return $_SERV...