/ Published in: PHP
All credit for this snippet goes to Roshan, link is given above.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function getRealIpAddr(){ //check ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; } //to check ip is pass from proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else{ $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } ?>
URL: http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html