Skip to content

Commit

Permalink
Merge pull request #10 from socketblind/tls_version_fix_below_php56
Browse files Browse the repository at this point in the history
Setting TLSv1.2 option for CURL if php version is below 5.6
  • Loading branch information
Attila Botz authored Mar 12, 2019
2 parents 379a070 + 8c3ef43 commit 98e444d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/BarionClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ private function PostToBarion($url, $data)
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "User-Agent: $userAgent"));

if(substr(phpversion(), 0, 3) < 5.6) {
curl_setopt($ch, CURLOPT_SSLVERSION, 6);
}

if ($this->UseBundledRootCertificates) {
curl_setopt($ch, CURLOPT_CAINFO, join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'ssl', 'cacert.pem')));
Expand Down Expand Up @@ -259,6 +263,10 @@ private function GetFromBarion($url, $data)
curl_setopt($ch, CURLOPT_URL, $fullUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Agent: $userAgent"));

if(substr(phpversion(), 0, 3) < 5.6) {
curl_setopt($ch, CURLOPT_SSLVERSION, 6);
}

if ($this->UseBundledRootCertificates) {
curl_setopt($ch, CURLOPT_CAINFO, join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'ssl', 'cacert.pem')));
Expand Down

0 comments on commit 98e444d

Please sign in to comment.