diff --git a/lib/FreshBooksRequest.php b/lib/FreshBooksRequest.php index 2d15962..c55c855 100644 --- a/lib/FreshBooksRequest.php +++ b/lib/FreshBooksRequest.php @@ -67,6 +67,24 @@ public static function init($domain, $token) { self::$_domain = $domain; self::$_token = $token; + self::$_disable_ssl_verification = false; + } + + /* + * Turn off SSL peer verification. + * + * You may need to do this if your curl installation does not have + * the proper certificate authority information. + * + * If possible, fix your curl configuration instead as with this + * option set, intermediaries will be able to pretend to be + * FreshBooks. + * + * @return null + */ + public static function disableSSLVerification() + { + self::$_disable_ssl_verification = true; } /* @@ -163,7 +181,9 @@ public function request() curl_setopt($ch, CURLOPT_TIMEOUT, 40); // times out after 40s curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); // add POST fields curl_setopt($ch, CURLOPT_USERPWD, self::$_token . ':X'); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + if (self::$_disable_ssl_verification) { + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + } $result = curl_exec($ch);