I have already researched in several forums and even here but none of the solutions I have seen have brought me the correct result. In all the attempts I get 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;
?>