diff --git a/Services/Zencoder.php b/Services/Zencoder.php index 6d453d7..d11a182 100644 --- a/Services/Zencoder.php +++ b/Services/Zencoder.php @@ -96,12 +96,16 @@ class Services_Zencoder extends Services_Zencoder_Base * @param string $api_version API version * @param string $api_host API host * @param bool $debug Enable debug mode + * @param string $ca_path Path to a directory that holds multiple CA certificates + * @param string $ca_file Path to a file holding one or more certificates to verify the peer with */ public function __construct( $api_key = NULL, $api_version = 'v2', $api_host = 'https://app.zencoder.com', - $debug = false + $debug = false, + $ca_path = NULL, + $ca_file = NULL ) { // Check that library dependencies are met @@ -114,13 +118,18 @@ public function __construct( if (!function_exists('curl_init')) { throw new Services_Zencoder_Exception('cURL extension must be enabled.'); } + $this->version = $api_version; - $this->http = new Services_Zencoder_Http( - $api_host, - array("curlopts" => array( - CURLOPT_USERAGENT => self::USER_AGENT - ), "api_key" => $api_key, "debug" => $debug) - ); + + $http_options = array("api_version" => $api_key, "debug" => $debug, "curlopts" => array(CURLOPT_USERAGENT => self::USER_AGENT)); + if (isset($ca_path)) { + $http_options["curlopts"][CURLOPT_CAPATH] = realpath($ca_path); + } + if (isset($ca_file)) { + $http_options["curlopts"][CURLOPT_CAINFO] = realpath($ca_file); + } + + $this->http = new Services_Zencoder_Http($api_host, $http_options); $this->accounts = new Services_Zencoder_Accounts($this); $this->inputs = new Services_Zencoder_Inputs($this); $this->jobs = new Services_Zencoder_Jobs($this);