1
function getRealIP() {
if (!empty($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
return $_SERVER['REMOTE_ADDR'];
}
echo getRealIP();
echo $_SERVER['REMOTE_ADDR'];
What’s wrong with that code?
'Cause that’s the only way his score works ::1
, tried several times and only gives this result.
If you are running the local network script, the result will be this. This is the interface IP lo (loopback). Try using in production or on a test platform like phptester.net
– Mauro Alexandre