z_fetch_url - include curl debug info in return array and log it (at logger_data level) on failure
This should probably be at a lower log level, but unsuccessful connections could happen a lot on a busy production site so we'll try to keep the log noise down unless somebody really needs to track this info.
This commit is contained in:
parent
933c30d95d
commit
72f562c190
@ -312,8 +312,13 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
|
|||||||
$rc = intval($http_code);
|
$rc = intval($http_code);
|
||||||
$ret['return_code'] = $rc;
|
$ret['return_code'] = $rc;
|
||||||
$ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false);
|
$ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false);
|
||||||
|
if(! $ret['success']) {
|
||||||
|
$ret['debug'] = $curl_info;
|
||||||
|
logger('z_fetch_url: debug:' . print_r($curl_info,true), LOGGER_DATA);
|
||||||
|
}
|
||||||
$ret['body'] = substr($s,strlen($header));
|
$ret['body'] = substr($s,strlen($header));
|
||||||
$ret['header'] = $header;
|
$ret['header'] = $header;
|
||||||
|
|
||||||
@curl_close($ch);
|
@curl_close($ch);
|
||||||
return($ret);
|
return($ret);
|
||||||
}
|
}
|
||||||
@ -407,6 +412,11 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
|
|||||||
$rc = intval($http_code);
|
$rc = intval($http_code);
|
||||||
$ret['return_code'] = $rc;
|
$ret['return_code'] = $rc;
|
||||||
$ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false);
|
$ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false);
|
||||||
|
if(! $ret['success']) {
|
||||||
|
$ret['debug'] = $curl_info;
|
||||||
|
logger('z_fetch_url: debug:' . print_r($curl_info,true), LOGGER_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
$ret['body'] = substr($s,strlen($header));
|
$ret['body'] = substr($s,strlen($header));
|
||||||
$ret['header'] = $header;
|
$ret['header'] = $header;
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
@ -1 +1 @@
|
|||||||
2013-09-09.431
|
2013-09-10.432
|
||||||
|
Reference in New Issue
Block a user