2
I have researched several forums and even here but none of the solutions I saw brought me the right result. On all attempts I receive as ip ::1
Follow the code I’m using
<?php
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip_address = $_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip_address = $_SERVER['REMOTE_ADDR'];
}
echo $ip_address;
?>
@Stormwind No solution available
– Renato Junior
@RORSCHACH, has no solution accepted, but if you see the first answer, it already responds to what the user wants (more specifically in the 3rd line).
– UzumakiArtanis