I'm using a CURL function in this way, to read the contents of curl
with the user's IP, not the server's:
function curl($url) {
$curl = curl_init($url) or die("Erro, o CURL não está habilitado.");
curl_setopt($curl, CURLOPT_HTTPHEADER, array('X-Forwarded-For: ' . $_SERVER["HTTP_CF_CONNECTING_IP"]));
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$string = curl_exec($curl);
curl_close($curl);
return $string;
}
However, it is not working.
It ends up using the IP of the server even using $_SERVER["HTTP_CF_CONNECTING_IP"]
, since the site is in Cloudflare.
Is it possible to fix this?