Friday, 7 March 2014

Get IP address of an user even if he is using proxy

In Last post,i have shown you how to get IP address of an user in simple manner
But it won't work in case the user is using proxy......


But still there is a way to fetch User IP even if  User using a proxy .


Here We Go :




  1.  <?php  
  2.  $http_cli_ip = $_SERVER['HTTP_CLIENT_IP'];    
  3.               //for checking actual internet ip rather than computer ip  
  4.  $http_ford = $_SERVER['HTTP_X_FORWARDED_FOR'];  
  5.              //this one is the next to check  
  6.  $remote_address = $_SERVER['REMOTE_ADDR'];  
  7.              //finally the computer ip  
  8.  if(!empty($http_cli_ip))  
  9.  { $ip_address = $http_cli_ip ;  }  
  10.  else if(!empty($http_ford))  
  11.  { $ip_address = $http_ford; }  
  12.  else  
  13.  { $ip_address = $remote_address; }  
  14.  echo $ip_address;  
  15.  ?>


This Will fetch Users IP (Remember it has also its own weakness ) 

No comments:

Post a comment

THANKS FOR UR GREAT COMMENT

Blogger Widgets