Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a535121ab1 | ||
![]() |
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);
|
||||||
@ -180,7 +151,6 @@ function getContents($url, $header = array(), $opts = array(), $returnHeader = f
|
|||||||
foreach($opts as $key => $value) {
|
foreach($opts as $key => $value) {
|
||||||
curl_setopt($ch, $key, $value);
|
curl_setopt($ch, $key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defined('PROXY_URL') && !defined('NOPROXY')) {
|
if(defined('PROXY_URL') && !defined('NOPROXY')) {
|
||||||
@ -225,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…
x
Reference in New Issue
Block a user