Closed
Description
If "allow_url_fopen" is not set on the server in php.ini then file_get_contents always returns null. I've included a new version executeDownload that I used to get around this issue. It uses the more secure curl function.
private function executeDownload($url) {
if($this->cache_handler == null) {
$data = @file_get_contents($url);
if(!$data) {
if (function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
curl_close($curl);
if(!$data) $this->error = "Invalid URL";
} else {
$this->error = "Invalid URL or check php.ini for allow_url_fopen";
}
}
}
else {
$data = $this->attemptGetFromCache($url);
}
return $data;
}
Metadata
Metadata
Assignees
Labels
No labels