fix: require curl extension

This commit is contained in:
Dag 2022-04-08 19:54:08 +02:00
parent c0e2a430ab
commit b55c5090e6

View File

@ -128,35 +128,6 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f
'content' => '',
);
// Use file_get_contents() if curl module is not installed
if(! function_exists('curl_version')) {
$httpHeaders = '';
foreach ($header as $headerL) {
$httpHeaders .= $headerL . "\r\n";
}
$ctx = stream_context_create(array(
'http' => array(
'header' => $httpHeaders
)
));
$data = @file_get_contents($url, 0, $ctx);
if($data === false) {
$errorCode = 500;
} else {
$errorCode = 200;
$retVal['header'] = implode("\r\n", $http_response_header);
}
$curlError = '';
$curlErrno = '';
$headerSize = 0;
$finalHeader = array();
} else {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
@ -224,7 +195,6 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f
$finalHeader = end($headers);
curl_close($ch);
}
$finalHeader = array_change_key_case($finalHeader, CASE_LOWER);