当前位置: 首页>>代码示例>>PHP>>正文


PHP Braintree_Configuration::sslOn方法代码示例

本文整理汇总了PHP中Braintree_Configuration::sslOn方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Configuration::sslOn方法的具体用法?PHP Braintree_Configuration::sslOn怎么用?PHP Braintree_Configuration::sslOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Braintree_Configuration的用法示例。


在下文中一共展示了Braintree_Configuration::sslOn方法的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);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:30,代码来源:Http.php

示例2: testSSLOn

 function testSSLOn()
 {
     Braintree_Configuration::environment('development');
     $on = Braintree_Configuration::sslOn();
     $this->assertFalse($on);
     Braintree_Configuration::environment('sandbox');
     $on = Braintree_Configuration::sslOn();
     $this->assertTrue($on);
     Braintree_Configuration::environment('production');
     $on = Braintree_Configuration::sslOn();
     $this->assertTrue($on);
     Braintree_Configuration::reset();
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:13,代码来源:ConfigurationTest.php


注:本文中的Braintree_Configuration::sslOn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。