Skip to content

Commit 3cc1f9e

Browse files
committed
added ssl
1 parent c841406 commit 3cc1f9e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cleantalk.class.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,12 @@ class Cleantalk {
428428
* @var bool
429429
*/
430430
public $ssl_on = false;
431+
432+
/**
433+
* Path to SSL certificate
434+
* @var string
435+
*/
436+
public $ssl_path = '';
431437

432438
/**
433439
* Minimal server response in miliseconds to catch the server
@@ -625,10 +631,15 @@ private function sendRequest($data = null, $url, $server_timeout = 3) {
625631

626632
// Disabling CA cert verivication
627633
// Disabling common name verification
628-
if ($this->ssl_on) {
634+
if ($this->ssl_on && $this->ssl_path=='') {
629635
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
630636
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
631637
}
638+
else if ($this->ssl_on && $this->ssl_path!='') {
639+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
640+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
641+
curl_setopt($ch, CURLOPT_CAINFO, $this->ssl_path);
642+
}
632643

633644
$result = curl_exec($ch);
634645
if (!$result) {

0 commit comments

Comments
 (0)