I have a php script that I use for a few weeks and that allows me to capture the ip of the person who visits my website, but since a few days (I have the impression that since That I activated the option "CDN + HTTP/2" on my hostserver OVH) that my script returns me one of the multiple public ip address of my web host OVH.
Here's the script:
function get_ip() {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
}
elseif (getenv('HTTP_X_COMING_FROM')) {
$ip = getenv('HTTP_X_COMING_FROM');
}
elseif (getenv('HTTP_VIA')) {
$ip = getenv('HTTP_VIA');
}
elseif (getenv('HTTP_XROXY_CONNECTION')) {
$ip = getenv('HTTP_XROXY_CONNECTION');
}
else {
$ip = getenv('REMOTE_ADDR');
}
return $ip;
}
$ip = get_ip();
Thank you for your help