-2
I’m using a CURL function this way, to read the contents of curl
with user IP and not server IP:
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;
}
But it’s not working.
Ends up using the server IP even using the $_SERVER["HTTP_CF_CONNECTING_IP"]
, since the site is on Cloudflare.
It is possible to correct this?