Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/FreshBooksRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down Expand Up @@ -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);

Expand Down