diff --git a/composer.json b/composer.json index ffb67d5..69c3788 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,8 @@ "require": { "php": ">=5.3", "ext-curl": "*", - "ext-json": "*" + "ext-json": "*", + "composer/ca-bundle": "^1.2" }, "require-dev": { "phpunit/phpunit": "7.0.*", diff --git a/src/MailChimp.php b/src/MailChimp.php index 016c3a7..aae17a1 100644 --- a/src/MailChimp.php +++ b/src/MailChimp.php @@ -2,6 +2,8 @@ namespace DrewM\MailChimp; +use Composer\CaBundle\CaBundle; + /** * Super-simple, minimum abstraction MailChimp API v3 wrapper * MailChimp API v3: http://developer.mailchimp.com @@ -243,6 +245,13 @@ private function makeRequest($http_verb, $method, $args = array(), $timeout = se curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLINFO_HEADER_OUT, true); + $caPathOrFile = CaBundle::getSystemCaRootBundlePath(); + if (is_dir($caPathOrFile)) { + curl_setopt($ch, CURLOPT_CAPATH, $caPathOrFile); + } else { + curl_setopt($ch, CURLOPT_CAINFO, $caPathOrFile); + } + switch ($http_verb) { case 'post': curl_setopt($ch, CURLOPT_POST, true);