diff options
author | Miha Petkovsek <miha.petkovsek@gmail.com> | 2016-11-23 18:23:27 +0100 |
---|---|---|
committer | Miha Petkovsek <miha.petkovsek@gmail.com> | 2016-11-23 18:23:27 +0100 |
commit | 989c13160c781b9bf419cd84c0a9760e1c4e2b05 (patch) | |
tree | 70d2539bde716a323fd1819e1995339f931af680 /php-client/class.phpipam-api.php | |
parent | 234d3667b356f192243fa019b993b65391b05469 (diff) | |
download | phpipam-api-clients-989c13160c781b9bf419cd84c0a9760e1c4e2b05.tar.gz |
Added response headers to API->response_headers
Diffstat (limited to 'php-client/class.phpipam-api.php')
-rw-r--r-- | php-client/class.phpipam-api.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/php-client/class.phpipam-api.php b/php-client/class.phpipam-api.php index 686a16b..a668dd2 100644 --- a/php-client/class.phpipam-api.php +++ b/php-client/class.phpipam-api.php @@ -200,6 +200,12 @@ class phpipam_api_client { "message" => "" ); + /** + * Reponse headers + * + * @var array + */ + public $response_headers = array (); @@ -538,7 +544,7 @@ class phpipam_api_client { * @return void */ public function set_api_identifiers ($identifiers) { - $this->api_server_identifiers = false; // clear this to forget any previous settings + $this->api_server_identifiers = false; // clear this to forget any previous settings if(is_array($identifiers)) { if(sizeof($identifiers)>0 && !$this->api_encrypt) { // reset @@ -624,6 +630,8 @@ class phpipam_api_client { // save result $this->result = (array) $res; } + // save reult + $this->curl_save_headers (); } /** @@ -654,7 +662,9 @@ class phpipam_api_client { CURLOPT_USERAGENT => 'phpipam-api php class', // ssl CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_SSL_VERIFYPEER => false + CURLOPT_SSL_VERIFYPEER => false, + // save headers + CURLINFO_HEADER_OUT => true ) ); } @@ -825,6 +835,17 @@ class phpipam_api_client { } /** + * Store result code + * + * @method curl_save_result_code + * @return void + */ + private function curl_save_headers () { + // save result and result code + $this->response_headers = curl_getinfo($this->Connection); + } + + /** * send authenticate request and save token if provided, otherwise throw error. * * @access private |