Skip to content

Commit 81cb7fe

Browse files
committed
Perform SSL verification by default, but provide a method to disable it.
1 parent 48612ea commit 81cb7fe

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/FreshBooksRequest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ public static function init($domain, $token)
6767
{
6868
self::$_domain = $domain;
6969
self::$_token = $token;
70+
self::$_disable_ssl_verification = false;
71+
}
72+
73+
public static function disableSSLVerification()
74+
{
75+
self::$_disable_ssl_verification = true;
7076
}
7177

7278
/*
@@ -163,7 +169,9 @@ public function request()
163169
curl_setopt($ch, CURLOPT_TIMEOUT, 40); // times out after 40s
164170
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); // add POST fields
165171
curl_setopt($ch, CURLOPT_USERPWD, self::$_token . ':X');
166-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
172+
if (self::$_disable_ssl_verification) {
173+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
174+
}
167175

168176
$result = curl_exec($ch);
169177

0 commit comments

Comments
 (0)