@@ -96,12 +96,16 @@ class Services_Zencoder extends Services_Zencoder_Base
9696 * @param string $api_version API version
9797 * @param string $api_host API host
9898 * @param bool $debug Enable debug mode
99+ * @param string $ca_path Path to a directory that holds multiple CA certificates
100+ * @param string $ca_file Path to a file holding one or more certificates to verify the peer with
99101 */
100102 public function __construct (
101103 $ api_key = NULL ,
102104 $ api_version = 'v2 ' ,
103105 $ api_host = 'https://app.zencoder.com ' ,
104- $ debug = false
106+ $ debug = false ,
107+ $ ca_path = NULL ,
108+ $ ca_file = NULL
105109 )
106110 {
107111 // Check that library dependencies are met
@@ -114,13 +118,18 @@ public function __construct(
114118 if (!function_exists ('curl_init ' )) {
115119 throw new Services_Zencoder_Exception ('cURL extension must be enabled. ' );
116120 }
121+
117122 $ this ->version = $ api_version ;
118- $ this ->http = new Services_Zencoder_Http (
119- $ api_host ,
120- array ("curlopts " => array (
121- CURLOPT_USERAGENT => self ::USER_AGENT
122- ), "api_key " => $ api_key , "debug " => $ debug )
123- );
123+
124+ $ http_options = array ("api_version " => $ api_key , "debug " => $ debug , "curlopts " => array (CURLOPT_USERAGENT => self ::USER_AGENT ));
125+ if (isset ($ ca_path )) {
126+ $ http_options ["curlopts " ][CURLOPT_CAPATH ] = realpath ($ ca_path );
127+ }
128+ if (isset ($ ca_file )) {
129+ $ http_options ["curlopts " ][CURLOPT_CAINFO ] = realpath ($ ca_file );
130+ }
131+
132+ $ this ->http = new Services_Zencoder_Http ($ api_host , $ http_options );
124133 $ this ->accounts = new Services_Zencoder_Accounts ($ this );
125134 $ this ->inputs = new Services_Zencoder_Inputs ($ this );
126135 $ this ->jobs = new Services_Zencoder_Jobs ($ this );
0 commit comments