I am having problems enabling file_get_contents
on my site. It was suggested I could use curl instead.
This is my original function, using file_get_contents
:
function getFile($fileQuery){
global $user, $pass, $domain;
return file_get_contents("https://$user:$pass@$domain:2083/".$fileQuery);
}
And this is what I tried, using curl:
function getFile($fileQuery){
global $user, $pass, $domain;
//return file_get_contents("https://$user:$pass@$domain:2083/".$fileQuery);
$url = "https://$user:$pass@$domain:2083/".$fileQuery;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
curl_setopt($ch, CURLOPT_TIMEOUT, 4000); //timeout in seconds
$result = curl_exec($ch);
echo "<pre>"; print_r($result);
curl_close($ch);
}
However, it's returning a blank page.
Any ideas?