mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-01 22:35:21 +03:00
fix: require curl extension (#2617)
This commit is contained in:
parent
db28bedb23
commit
c3a106892d
1 changed files with 63 additions and 94 deletions
|
@ -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);
|
||||
|
@ -180,7 +151,6 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f
|
|||
foreach($opts as $key => $value) {
|
||||
curl_setopt($ch, $key, $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(defined('PROXY_URL') && !defined('NOPROXY')) {
|
||||
|
@ -225,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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue