title: How to get real IP of user using PHP?
body: <p>I've been trying to get real IP address of the user, and not a proxy address. For that I've done this:</p>
  
  <pre><code>$ip1 = $_SERVER['REMOTE_ADDR'];
  $ip2 = $_SERVER['HTTP_X_FORWARDED_FOR'];
  $ip3 = $_SERVER['HTTP_FORWARDED'];
  mail("me@domain.com", "Report", "IP1 is $ip1, IP2 is $ip2, IP3 is $ip3 .");
  </code></pre>
  
  <p>But when  a user is using proxy, the above script gets the proxy address and not the real IP address:</p>
  
  <pre><code>IP is [proxy_addr_here], IP2 is  , IP3 is    .
  </code></pre>
  
  <p>Is there any way to get real IP just like whatismyip.com tells (it tells real IP address, proxy address and useragent)?</p>
  
  <p><em>Update</em> : Whatismyip tells me this 
  "Your IP Address Is: [my real IP]
  Proxy: [my proxy address]
  City: Alipur
  State/Region: Delhi
  Country: IN -
  ISP: Bharti Airtel Ltd."</p>
  
  <p>How come it gathers all the details so accurately but not my PHP script?</p>