From 989c13160c781b9bf419cd84c0a9760e1c4e2b05 Mon Sep 17 00:00:00 2001 From: Miha Petkovsek Date: Wed, 23 Nov 2016 18:23:27 +0100 Subject: Added response headers to API->response_headers --- php-client/class.phpipam-api.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'php-client/class.phpipam-api.php') 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 ) ); } @@ -824,6 +834,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. * -- cgit v1.2.3