Get a visitor\'s real IP address.
A more reliable way to obtain a visitor's IP address.
Copy this code and paste it in your HTML
<?php
function getRealIp()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])){ $ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
?>
Report this snippet
Comments
Subscribe to comments