Bugfix: The function "z_fetch_url" created warnings under certain circumstances.
This commit is contained in:
parent
72e3ffbb4d
commit
2038e65a57
|
@ -10,16 +10,14 @@ if(! function_exists('fetch_url')) {
|
||||||
function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_content=Null, $cookiejar = 0) {
|
function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_content=Null, $cookiejar = 0) {
|
||||||
|
|
||||||
$ret = z_fetch_url(
|
$ret = z_fetch_url(
|
||||||
$url,
|
$url,
|
||||||
$binary,
|
$binary,
|
||||||
$redirects,
|
$redirects,
|
||||||
array('timeout'=>$timeout,
|
array('timeout'=>$timeout,
|
||||||
'accept_content'=>$accept_content,
|
'accept_content'=>$accept_content,
|
||||||
'cookiejar'=>$cookiejar
|
'cookiejar'=>$cookiejar
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return($ret['body']);
|
return($ret['body']);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -40,7 +38,7 @@ if(!function_exists('z_fetch_url')){
|
||||||
* * \b novalidate => do not validate SSL certs, default is to validate using our CA list
|
* * \b novalidate => do not validate SSL certs, default is to validate using our CA list
|
||||||
* * \b nobody => only return the header
|
* * \b nobody => only return the header
|
||||||
* * \b cookiejar => path to cookie jar file
|
* * \b cookiejar => path to cookie jar file
|
||||||
*
|
*
|
||||||
* @return array an assoziative array with:
|
* @return array an assoziative array with:
|
||||||
* * \e int \b return_code => HTTP return code or 0 if timeout or failure
|
* * \e int \b return_code => HTTP return code or 0 if timeout or failure
|
||||||
* * \e boolean \b success => boolean true (if HTTP 2xx result) or false
|
* * \e boolean \b success => boolean true (if HTTP 2xx result) or false
|
||||||
|
@ -50,7 +48,7 @@ if(!function_exists('z_fetch_url')){
|
||||||
function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) {
|
function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) {
|
||||||
|
|
||||||
$ret = array('return_code' => 0, 'success' => false, 'header' => "", 'body' => "");
|
$ret = array('return_code' => 0, 'success' => false, 'header' => "", 'body' => "");
|
||||||
|
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
|
|
||||||
|
@ -154,7 +152,7 @@ function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) {
|
||||||
if (filter_var($newurl, FILTER_VALIDATE_URL)) {
|
if (filter_var($newurl, FILTER_VALIDATE_URL)) {
|
||||||
$redirects++;
|
$redirects++;
|
||||||
@curl_close($ch);
|
@curl_close($ch);
|
||||||
return fetch_url($newurl,$binary,$redirects,$timeout,$accept_content,$cookiejar);
|
return z_fetch_url($newurl,$binary, $redirects, $opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,9 +180,9 @@ function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) {
|
||||||
$ret['debug'] = $curl_info;
|
$ret['debug'] = $curl_info;
|
||||||
}
|
}
|
||||||
@curl_close($ch);
|
@curl_close($ch);
|
||||||
|
|
||||||
$a->save_timestamp($stamp1, "network");
|
$a->save_timestamp($stamp1, "network");
|
||||||
|
|
||||||
return($ret);
|
return($ret);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in a new issue