I have the following script in a php file to get the user's IP..
<?php
function GetIP()
{
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $keyip)
{
if (array_key_exists($keyip, $_SERVER) === true)
{
foreach (array_map('trim', explode(',', $_SERVER[$keyip])) as $uip)
{
if (filter_var($uip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false)
{
return $uip;
}
}
}
}
}
$ip = GetIP();
echo $ip;
?>
and it works fine when I run it from my computer or MY phone (using Chrome browser), returning my correct IP address in Argentina. However, when I run it from both of my brother's phone using the Chrome browser it is giving me 66.249.85.30 which seems to be a Google proxy (hostname: google-proxy-66-249-85-30.google.com). When I use the regular internet browser on the phones it gives the correct IP address.
When I do an online search to get my IP address using the Chrome browser on my brothers' phones, it (whatismyip.com) returns the correct IP address and not the Google IP, so it has to be possible.
Does anyone know why it is doing this and what can be done to get the real IP address?