Posted by: Anil Kumar Panigrahi in: ● October 15, 2009
The code will get the real IP address of running those scripts.
<?php
function getRealIpAddress()
{
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;
}
echo getRealIpAddress(); // display the real IP address
?>
it will be useful.
Demo is at http://labs.anil2u.info/realIP.php
1 | Webby Scripts How to get the real IP address using php?
15 de October de 2009 to ● 1:58 pm
[...] more here: How to get the real IP address using php? [...]
Comments