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


PHP Zend_Http_Client_Adapter_Socket::setConfig方法代码示例

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


在下文中一共展示了Zend_Http_Client_Adapter_Socket::setConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createAdapterFromConfig

 /**
  * @param Enlight_Config $config
  * @see https://github.com/paypal/sdk-core-php
  * @return Zend_Http_Client_Adapter_Curl|Zend_Http_Client_Adapter_Socket
  */
 public static function createAdapterFromConfig($config)
 {
     $curl = $config->get('paypalCurl', true);
     $sslVersion = $config->get('paypalSslVersion', 0);
     $timeout = $config->get('paypalTimeout') ?: 60;
     $userAgent = 'Shopware/' . Shopware::VERSION;
     if ($curl && extension_loaded('curl')) {
         $adapter = new Zend_Http_Client_Adapter_Curl();
         $adapter->setConfig(array('useragent' => $userAgent, 'timeout' => $timeout));
         if (!empty($config->paypalSandbox)) {
             $adapter->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
             $adapter->setCurlOption(CURLOPT_SSL_VERIFYHOST, false);
         }
         $adapter->setCurlOption(CURLOPT_TIMEOUT, $timeout);
         $adapter->setCurlOption(CURLOPT_SSLVERSION, $sslVersion);
         //$adapter->setCurlOption(CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
         //$adapter->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1);
         //$adapter->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2);
     } else {
         $adapter = new Zend_Http_Client_Adapter_Socket();
         $adapter->setConfig(array('useragent' => $userAgent, 'timeout' => $timeout, 'ssltransport' => $sslVersion > 3 || $sslVersion == 1 ? 'tls' : 'ssl'));
     }
     return $adapter;
 }
开发者ID:NikolaIvanovski,项目名称:SwagPaymentPaypal,代码行数:29,代码来源:RestClient.php

示例2: getRestClient

 /**
  * Returns a reference to the REST client
  *
  * @return Zend_Rest_Client
  */
 public function getRestClient()
 {
     if ($this->_rest === null) {
         /**
          * @see Zend_Rest_Client
          */
         require_once 'Zend/Rest/Client.php';
         $this->_rest = new Zend_Rest_Client();
         /**
          * @see Zend_Http_Client
          */
         require_once 'Zend/Http/Client.php';
         $httpClient = new Zend_Http_Client($this->_baseUri, array('keepalive' => $this->_usePersistentConnections));
         /**
          * The Ticket Evolution Sandbox uses a self-signed certificate which,
          * by default is not allowed. If we are using https in the sandbox lets
          * tweak the options to allow this self-signed certificate.
          *
          * @link http://framework.zend.com/manual/en/zend.http.client.adapters.html Example 2
          */
         if (strpos($this->_baseUri, 'sandbox') !== false) {
             $streamOptions = array('ssl' => array('allow_self_signed' => true));
         } else {
             $streamOptions = array();
         }
         /**
          * Create an adapter object and attach it to the HTTP client
          *
          * @see Zend_Http_Client_Adapter_Socket
          */
         require_once 'Zend/Http/Client/Adapter/Socket.php';
         $adapter = new Zend_Http_Client_Adapter_Socket();
         $adapterConfig = array('persistent' => $this->_usePersistentConnections);
         $adapter->setConfig($adapterConfig);
         $httpClient->setAdapter($adapter);
         // Pass the streamOptions array to setStreamContext()
         $adapter->setStreamContext($streamOptions);
         $this->_rest->setHttpClient($httpClient);
     }
     return $this->_rest;
 }
开发者ID:4ticketdeals,项目名称:ticketevolution-php,代码行数:46,代码来源:Webservice.php


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