mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-10 17:08:47 +00:00
fix: require curl extension
This commit is contained in:
parent
c0e2a430ab
commit
b55c5090e6
@ -128,35 +128,6 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f
|
|||||||
'content' => '',
|
'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);
|
$ch = curl_init($url);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
@ -224,7 +195,6 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f
|
|||||||
$finalHeader = end($headers);
|
$finalHeader = end($headers);
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
}
|
|
||||||
|
|
||||||
$finalHeader = array_change_key_case($finalHeader, CASE_LOWER);
|
$finalHeader = array_change_key_case($finalHeader, CASE_LOWER);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user