diff --git a/src/HipChat/HipChat.php b/src/HipChat/HipChat.php index ac93d3a..88896d4 100644 --- a/src/HipChat/HipChat.php +++ b/src/HipChat/HipChat.php @@ -1,5 +1,7 @@ verify_ssl); if (is_array($post_data)) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); @@ -216,11 +220,26 @@ public function make_request($api_method, $args = array(), return $response; } + + /** + * Enable/disable verify_ssl. + * This is useful when curl spits back ssl verification errors, most likely due to + * outdated SSL CA bundle file on server. If you are able to, update that CA bundle. + * If not, call this method with false for $bool param before interacting with the API. + * + * @param bool $bool + * @return bool + */ + public function set_verify_ssl($bool = true) + { + $this->verify_ssl = (bool) $bool; + return $this->verify_ssl; + } } -class HipChat_Exception extends Exception { +class HipChat_Exception extends \Exception { public function __construct($code, $info, $url) { $message = "HipChat API error: code=$code, info=$info, url=$url"; parent::__construct($message, (int)$code);