Skip to content

Commit f2c2f88

Browse files
committed
curl support error info
1 parent 1ee0710 commit f2c2f88

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/Very/Support/Curl.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Curl {
2323
private $is_stat = true; //是否监控统计
2424
private $referer = NULL;
2525
private $curl_error;
26+
private $error_info;
2627
private $body;
2728
private $header;
2829
private $is_log = false;
@@ -106,6 +107,7 @@ private function exec($url, $method = 'GET', $post_data = '')
106107
$this->body = curl_exec($this->ch);
107108
$this->curl_error = curl_errno($this->ch);
108109
$this->header = curl_getinfo($this->ch);
110+
$this->error_info = curl_error($this->ch);
109111
$this->log($url);
110112
if (is_resource($this->ch)) {
111113
curl_close($this->ch);
@@ -222,7 +224,8 @@ public function debug() {
222224
'状态' => $this->getStatusCode(), // http_code
223225
'请求耗时' => $this->getRequestTime(), //request_time
224226
'错误码' => $this->getError(), //errno
225-
'Header' => $this->getHeader(), //errno
227+
'Header' => $this->getHeader(), //header
228+
'ErrInfo'=> $this->getErrorInfo()//error info
226229
];
227230
}
228231

@@ -323,6 +326,10 @@ public function getError() {
323326
return $this->curl_error;
324327
}
325328

329+
public function getErrorInfo(){
330+
return $this->error_info;
331+
}
332+
326333
public function getBody() {
327334
return $this->body;
328335
}

0 commit comments

Comments
 (0)