mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-31 12:43:14 +00:00
Set http error message when available
This commit is contained in:
+4
-1
@@ -90,7 +90,6 @@ class Curl {
|
||||
$this->http_error = in_array(floor($this->http_error_code / 100), array(4, 5));
|
||||
$this->error = $this->curl_error || $this->http_error;
|
||||
$this->error_code = $this->curl_error ? $this->curl_error_code : $this->http_error_code;
|
||||
$this->error_message = $this->curl_error ? $this->curl_error_message : $this->http_error_message;
|
||||
|
||||
$this->request_headers = preg_split('/\r\n/', curl_getinfo($this->curl, CURLINFO_HEADER_OUT), NULL, PREG_SPLIT_NO_EMPTY);
|
||||
$this->response_headers = '';
|
||||
@@ -103,6 +102,9 @@ class Curl {
|
||||
$this->response_headers = preg_split('/\r\n/', $this->response_headers, NULL, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
$this->http_error_message = isset($this->response_headers['0']) ? $this->response_headers['0'] : '';
|
||||
$this->error_message = $this->curl_error ? $this->curl_error_message : $this->http_error_message;
|
||||
|
||||
return $this->error_code;
|
||||
}
|
||||
|
||||
@@ -125,6 +127,7 @@ class Curl {
|
||||
|
||||
public $http_error = FALSE;
|
||||
public $http_error_code = NULL;
|
||||
public $http_error_message = NULL;
|
||||
|
||||
public $request_headers = NULL;
|
||||
public $response = NULL;
|
||||
|
||||
Reference in New Issue
Block a user