本文整理汇总了PHP中Braintree_Configuration::caFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Configuration::caFile方法的具体用法?PHP Braintree_Configuration::caFile怎么用?PHP Braintree_Configuration::caFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_Configuration
的用法示例。
在下文中一共展示了Braintree_Configuration::caFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doUrlRequest
public static function _doUrlRequest($httpVerb, $url, $requestBody = null)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $httpVerb);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xml', 'Content-Type: application/xml', 'User-Agent: Braintree PHP Library ' . Braintree_Version::get(), 'X-ApiVersion: ' . Braintree_Configuration::API_VERSION));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, Braintree_Configuration::publicKey() . ':' . Braintree_Configuration::privateKey());
// curl_setopt($curl, CURLOPT_VERBOSE, true);
if (Braintree_Configuration::sslOn()) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_CAINFO, Braintree_Configuration::caFile());
}
if (!empty($requestBody)) {
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
$httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
if (Braintree_Configuration::sslOn()) {
if ($httpStatus == 0) {
throw new Braintree_Exception_SSLCertificate();
}
}
return array('status' => $httpStatus, 'body' => $response);
}
示例2: testCaFile
function testCaFile()
{
Braintree_Configuration::environment('development');
$this->setExpectedException('Braintree_Exception_SSLCaFileNotFound');
Braintree_Configuration::caFile('/does/not/exist/');
}