當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Http_Client::setAdapter方法代碼示例

本文整理匯總了PHP中Zend_Http_Client::setAdapter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Http_Client::setAdapter方法的具體用法?PHP Zend_Http_Client::setAdapter怎麽用?PHP Zend_Http_Client::setAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Http_Client的用法示例。


在下文中一共展示了Zend_Http_Client::setAdapter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 /**
  * @return $this
  * @throws Zend_Http_Client_Exception
  */
 public function init()
 {
     $this->initConfig();
     $this->_http = new Zend_Http_Client();
     $this->_http->setAdapter(new Zend_Http_Client_Adapter_Curl());
     $this->_http->setHeaders(array('Accept' => 'application/' . static::API_RESPONSE_FORMAT, 'Authorization' => 'WSSE profile="UsernameToken"', 'X-WSSE' => $this->_getWsseHeader()));
     return $this;
 }
開發者ID:eltrino,項目名稱:DiamanteDeskMagentoExtension,代碼行數:12,代碼來源:Api.php

示例2: setXmlProvider

 /**
  * Sets the XML provider to be used in conjunction with SimpleXMLElement
  *
  * @param Varien_Http_Adapter_Curl $provider
  *
  * @return Bronto_Common_Helper_Data
  */
 public function setXmlProvider(Varien_Http_Adapter_Curl $provider)
 {
     if (is_null($this->_client)) {
         $this->_client = new Zend_Http_Client();
     }
     $this->_xmlProvider = $provider;
     $this->_client->setAdapter($provider);
     return $this;
 }
開發者ID:bevello,項目名稱:bevello,代碼行數:16,代碼來源:Data.php

示例3: __construct

 /**
  * Initialization of the class
  */
 private function __construct()
 {
     // create a new handler for http using zend_http_cient
     $this->_handler = new Zend_Http_Client();
     // create a new adapter using curl
     $curlAdapter = new Zend_Http_Client_Adapter_Curl();
     // set the adapter for http client (curl)
     $this->_handler->setAdapter($curlAdapter);
     // set the main reguest method to be used by default
     $this->_requestMethod = Zend_Http_Client::GET;
 }
開發者ID:georgetutuianu,項目名稱:licenta,代碼行數:14,代碼來源:HttpHandler.php

示例4: validate

 public function validate($username, $password)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Options: ' . print_r($this->_options, true));
     }
     $url = isset($this->_options['url']) ? $this->_options['url'] : 'https://localhost/validate/check';
     $adapter = new Zend_Http_Client_Adapter_Socket();
     $adapter->setStreamContext($this->_options = array('ssl' => array('verify_peer' => isset($this->_options['ignorePeerName']) ? false : true, 'allow_self_signed' => isset($this->_options['allowSelfSigned']) ? true : false)));
     $client = new Zend_Http_Client($url, array('maxredirects' => 0, 'timeout' => 30));
     $client->setAdapter($adapter);
     $params = array('user' => $username, 'pass' => $password);
     $client->setParameterPost($params);
     try {
         $response = $client->request(Zend_Http_Client::POST);
     } catch (Zend_Http_Client_Adapter_Exception $zhcae) {
         Tinebase_Exception::log($zhcae);
         return Tinebase_Auth::FAILURE;
     }
     $body = $response->getBody();
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Request: ' . $client->getLastRequest());
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Response: ' . $body);
     }
     if ($response->getStatus() !== 200) {
         return Tinebase_Auth::FAILURE;
     }
     $result = Tinebase_Helper::jsonDecode($body);
     if (isset($result['result']) && $result['result']['status'] === true && $result['result']['value'] === true) {
         return Tinebase_Auth::SUCCESS;
     } else {
         return Tinebase_Auth::FAILURE;
     }
 }
開發者ID:ingoratsdorf,項目名稱:Tine-2.0-Open-Source-Groupware-and-CRM,代碼行數:35,代碼來源:PrivacyIdea.php

示例5: getTransports

 private function getTransports()
 {
     $browserSocket = new \Buzz\Browser();
     $browserSocket->setClient(new \Buzz\Client\FileGetContents());
     $zendFrameworkOneHttpClientSocket = new \Zend_Http_Client();
     $zendFrameworkOneHttpClientSocket->setAdapter(new \Zend_Http_Client_Adapter_Socket());
     $zendFrameworkOneHttpClientProxy = new \Zend_Http_Client();
     $zendFrameworkOneHttpClientProxy->setAdapter(new \Zend_Http_Client_Adapter_Proxy());
     $zendFrameworkTwoHttpClientSocket = new \Zend\Http\Client();
     $zendFrameworkTwoHttpClientSocket->setAdapter(new \Zend\Http\Client\Adapter\Socket());
     $zendFrameworkTwoHttpClientProxy = new \Zend\Http\Client();
     $zendFrameworkTwoHttpClientProxy->setAdapter(new \Zend\Http\Client\Adapter\Proxy());
     $artaxClient = new \Amp\Artax\Client();
     $transports = array(new fXmlRpc\Transport\StreamSocketTransport(), new fXmlRpc\Transport\BuzzBrowserBridge($browserSocket), new fXmlRpc\Transport\ZendFrameworkOneHttpClientBridge($zendFrameworkOneHttpClientSocket), new fXmlRpc\Transport\ZendFrameworkOneHttpClientBridge($zendFrameworkOneHttpClientProxy), new fXmlRpc\Transport\ZendFrameworkTwoHttpClientBridge($zendFrameworkTwoHttpClientSocket), new fXmlRpc\Transport\ZendFrameworkTwoHttpClientBridge($zendFrameworkTwoHttpClientProxy), new fXmlRpc\Transport\ArtaxBrowserBridge($artaxClient));
     if (extension_loaded('curl') && !in_array('php_curl', $this->disabledExtensions)) {
         $browserCurl = new \Buzz\Browser();
         $browserCurl->setClient(new \Buzz\Client\Curl());
         $transports[] = new fXmlRpc\Transport\BuzzBrowserBridge($browserCurl);
         $zendFrameworkOneHttpClientCurl = new \Zend_Http_Client();
         $zendFrameworkOneHttpClientCurl->setAdapter(new \Zend_Http_Client_Adapter_Curl());
         $transports[] = new fXmlRpc\Transport\ZendFrameworkOneHttpClientBridge($zendFrameworkOneHttpClientCurl);
         $zendFrameworkTwoHttpClientCurl = new \Zend\Http\Client();
         $zendFrameworkTwoHttpClientCurl->setAdapter(new \Zend\Http\Client\Adapter\Curl());
         $transports[] = new fXmlRpc\Transport\ZendFrameworkTwoHttpClientBridge($zendFrameworkTwoHttpClientCurl);
         $guzzle = new \Guzzle\Http\Client();
         $transports[] = new fXmlRpc\Transport\GuzzleBridge($guzzle);
         $transports[] = new fXmlRpc\Transport\CurlTransport();
     }
     return $transports;
 }
開發者ID:Banjerr,項目名稱:infusionPress_Forms,代碼行數:30,代碼來源:AbstractCombinatoricsClientTest.php

示例6: doRequest

 public function doRequest($url, $params = array())
 {
     $client = new Zend_Http_Client(trim($url), array());
     if (array_key_exists('raw', $params)) {
         $client->setRawData(json_encode($params['raw']), 'application/json');
     } else {
         $client->setParameterPost($params);
     }
     if (extension_loaded('curl')) {
         $adapter = new Zend_Http_Client_Adapter_Curl();
         $adapter->setCurlOption(CURLOPT_SSL_VERIFYPEER, true);
         $adapter->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2);
         $client->setAdapter($adapter);
     }
     $response = $client->request('POST');
     $res = $response->getBody();
     if ($response->isError()) {
         $this->log("Request fail. Http code : " . $response->getStatus() . ' Message : ' . $res, 'ERROR');
         $this->log("Request data : " . print_r($params, 1), 'ERROR');
         if (array_key_exists('raw', $params)) {
             return $response;
         }
     }
     if (array_key_exists('raw', $params)) {
         return json_decode($res, true);
     }
     $result = null;
     parse_str($res, $result);
     return $result;
 }
開發者ID:kirchbergerknorr,項目名稱:HeidelpayCD_Edition,代碼行數:30,代碼來源:Payment.php

示例7: getClient

 /**
  * @return Zend_Http_Client
  */
 public function getClient()
 {
     if ($this->_httpClient === null) {
         $this->_httpClient = new Zend_Http_Client();
         $this->_httpClient->setAdapter($this->_getAdapter());
         $this->_httpClient->setHeaders($this->_getHeaders());
     }
     return $this->_httpClient;
 }
開發者ID:freshdesk,項目名稱:magento_extension,代碼行數:12,代碼來源:Freshdesk.php

示例8: getHttpClient

 /**
  * @return Zend_Http_Client
  */
 public function getHttpClient()
 {
     $username = 'demo';
     $password = sha1('demo');
     $adapter = new Zend_Http_Client_Adapter_Curl();
     $adapter->setConfig(array('curloptions' => array(CURLOPT_HTTPAUTH => CURLAUTH_DIGEST, CURLOPT_USERPWD => "{$username}:{$password}")));
     $client = new Zend_Http_Client();
     $client->setAdapter($adapter);
     return $client;
 }
開發者ID:GerDner,項目名稱:luck-docker,代碼行數:13,代碼來源:MediaTest.php

示例9: testRedirectWithTrailingSpaceInLocationHeaderZF11283

 /**
  * Test that we can handle trailing space in location header
  *
  * @group ZF-11283
  * @link http://framework.zend.com/issues/browse/ZF-11283
  */
 public function testRedirectWithTrailingSpaceInLocationHeaderZF11283()
 {
     $this->_client->setUri('http://example.com/');
     $this->_client->setAdapter('Zend_Http_Client_Adapter_Test');
     $adapter = $this->_client->getAdapter();
     /* @var $adapter Zend_Http_Client_Adapter_Test */
     $response = "HTTP/1.1 302 Redirect\r\n" . "Content-Type: text/html; charset=UTF-8\r\n" . "Location: /test\r\n" . "Server: Microsoft-IIS/7.0\r\n" . "Date: Tue, 19 Apr 2011 11:23:48 GMT\r\n\r\n" . "RESPONSE";
     $adapter->setResponse($response);
     $res = $this->_client->request('GET');
     $lastUri = $this->_client->getUri();
     $this->assertEquals("/test", $lastUri->getPath());
 }
開發者ID:crodriguezn,項目名稱:crossfit-milagro,代碼行數:18,代碼來源:StaticTest.php

示例10: testMultibyteRawPostDataZF2098

 /**
  * Test that we properly calculate the content-length of multibyte-encoded
  * request body
  *
  * This may file in case that mbstring overloads the substr and strlen
  * functions, and the mbstring internal encoding is a multibyte encoding.
  *
  * @link http://framework.zend.com/issues/browse/ZF-2098
  */
 public function testMultibyteRawPostDataZF2098()
 {
     $this->_client->setAdapter('Zend_Http_Client_Adapter_Test');
     $this->_client->setUri('http://example.com');
     $bodyFile = dirname(__FILE__) . '/_files/ZF2098-multibytepostdata.txt';
     $this->_client->setRawData(file_get_contents($bodyFile), 'text/plain');
     $this->_client->request('POST');
     $request = $this->_client->getLastRequest();
     if (!preg_match('/^content-length:\\s+(\\d+)/mi', $request, $match)) {
         $this->fail("Unable to find content-length header in request");
     }
     $this->assertEquals(filesize($bodyFile), (int) $match[1]);
 }
開發者ID:nbcutech,項目名稱:o3drupal,代碼行數:22,代碼來源:StaticTest.php

示例11: setUp

 public function setUp()
 {
     $this->_adapter = new Zend_Http_Client_Adapter_Test();
     $this->_storage = new Zend_Feed_Pubsubhubbub_Storage_Filesystem();
     $this->_skey = sha1('http://www.example.com/callback' . 'http://www.example.com/topic' . 'subscription');
     $this->_tkey = sha1('http://www.example.com/callback' . 'http://www.example.com/topic' . 'challenge');
     $client = new Zend_Http_Client();
     $client->setAdapter($this->_adapter);
     Zend_Feed_Pubsubhubbub::setHttpClient($client);
     $this->_callback = new Zend_Feed_Pubsubhubbub_HubServer_Callback();
     $this->_callback->setStorage($this->_storage);
     $this->_originalServer = $_SERVER;
     $_SERVER['REQUEST_METHOD'] = 'POST';
 }
開發者ID:padraic,項目名稱:zfhubbub,代碼行數:14,代碼來源:CallbackTest.php

示例12: testMultibyteRawPostDataZF2098

 /**
  * Test that we properly calculate the content-length of multibyte-encoded
  * request body
  *
  * This may file in case that mbstring overloads the substr and strlen
  * functions, and the mbstring internal encoding is a multibyte encoding.
  *
  * @link http://framework.zend.com/issues/browse/ZF-2098
  */
 public function testMultibyteRawPostDataZF2098()
 {
     $this->_client->setAdapter('Zend\\Http\\Client\\Adapter\\Test');
     $this->_client->setUri('http://example.com');
     $bodyFile = __DIR__ . '/_files/ZF2098-multibytepostdata.txt';
     $this->_client->setRawBody(file_get_contents($bodyFile));
     $this->_client->setEncType('text/plain');
     $this->_client->setMethod('POST');
     $this->_client->send();
     $request = $this->_client->getLastRequest();
     if (!preg_match('/^content-length:\\s+(\\d+)/mi', $request, $match)) {
         $this->fail("Unable to find content-length header in request");
     }
     $this->assertEquals(filesize($bodyFile), (int) $match[1]);
 }
開發者ID:alab1001101,項目名稱:zf2,代碼行數:24,代碼來源:StaticTest.php

示例13: dispatch

 public function dispatch($route = '', $data = array())
 {
     if (!Mage::helper('recapture')->isEnabled()) {
         return false;
     }
     if (empty($route)) {
         return false;
     }
     $adapter = new Zend_Http_Client_Adapter_Curl();
     $client = new Zend_Http_Client('http://www.recapture.io/beacon/' . $route, array('timeout' => 1));
     $client->setParameterPost($data);
     $client->setAdapter($adapter);
     $client->setHeaders('Api-Key', Mage::helper('recapture')->getApiKey());
     $response = $client->request('POST');
     return $response;
 }
開發者ID:recaptureio,項目名稱:magento_connector,代碼行數:16,代碼來源:Transport.php

示例14: loadData

 /**
  * Lauch data collecting
  *
  * @param bool $printQuery
  * @param bool $logQuery
  * @return Varien_Data_Collection_Filesystem
  */
 public function loadData($printQuery = false, $logQuery = false)
 {
     if ($this->isLoaded()) {
         return $this;
     }
     try {
         $client = new Zend_Http_Client();
         $adapter = new Zend_Http_Client_Adapter_Curl();
         $client->setAdapter($adapter);
         $client->setUri($this->_getFeedUri());
         $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
         $client->setParameterGet('domain', Mage::app()->getRequest()->getHttpHost());
         $responseBody = $client->request()->getBody();
         $modules = Mage::helper('core')->jsonDecode($responseBody);
         if (!is_array($modules)) {
             throw new Exception('Decoding failed');
         }
     } catch (Exception $e) {
         // @todo remove this fix and add error message
         $modules = array('TM_Core' => array('code' => 'TM_Core', 'version' => '1.1.1', 'changelog' => '', 'link' => '', 'download_link' => '', 'identity_key_link' => ''), 'TM_License' => array('code' => 'TM_License', 'version' => '1.2.0', 'changelog' => '', 'link' => '', 'download_link' => '', 'identity_key_link' => ''), 'TM_Argento' => array('code' => 'TM_Argento', 'version' => '1.2.0', 'changelog' => '', 'link' => '', 'download_link' => '', 'identity_key_link' => '', 'changelog' => "\n1.2.0\nNew Pure theme added\nCss styles optimization\nCss styles improvements for small tablet devices\nRemoved php warnings during Argento installation\nFixed upsell products decoration with first/last classes\nAjaxSearch\n * Security bugfix\nAskit\n * Grammar errors fixed\nEasyslider\n * Nivo slider updated to version 3.2\nEasybanner\n * Title field should not be required, when using html mode\nFacebookLikeButton\n * Fixed access to facebook like button config section when internet connection is not available\nHighlight\n * Added translation of the highlight page title\nSoldtogether\n * Fixed bug, when no product is available, but soldtogether block is called\n\n1.1.2\nArgento\n * Html markup and css improvements. YSlow - 86 PageSpeed - 93\n * Review url fixed on product page\n * Lightboxpro config options updated to look good on mobile screens\n * Related products styles and image size improvements for small screen devices\n * All small images styles improved for mobile devices\n * Improved form styles\n * Fixed product listing on advanced search results\n * Facebook Like Button added\n * Scroll to top button added\nSoldtogether updated\n * Table prefix added to query\n * Amazon styled template will show only simple products\n * Fixed price calculation for bundle, configurable and grouped products when using amazon template\n * Collection queries improvements\nEasyslide updated\n * jQuery will not be added if nivo slider is not used\n * Default slider options added when creating new slider\n * Enabled option removed. Please use status option for each slider instance.\n * Load jQuery option now affects on adding jQuery library only: nivo javascript will be added if nivo slider is used.\nEasycatalogimg updated\n * Optional retina support added\n * Image dimensions added to html markup\nEasybanner updated\n * Ability to set image size added\n * Optional retina support added\n * Ability to use banner url for html mode added. Use the {{tm_banner_url}} variable in banner content.\n * Backend banner management interface improvements\n * Image dimensions added to html markup, when resizer is used\n\n1.1.1\nFixed column count with cache enabled on advanced search results and highlight pages\n\n1.1.0\nAdd to cart button improvements\nHeader styles made more compact for mobile devices\nSitemap toolbar style fixed\nProduct page tabs made horizontal for wide screens\nCheckout page design improvements\nProduct labels added to the product page image\nProduct labels output fixed for mobile devices\nAll module depends updated to the latest versions\n\n1.0.0\nRelease\n"), 'TM_ArgentoArgento' => array('code' => 'TM_ArgentoArgento', 'version' => '1.1.2', 'changelog' => "\n1.1.2\nSee TM_Argento changelog\nImproved form styles\n\n1.1.1\nSee TM_Argento changelog\n\n1.1.0\nSee TM_Argento changelog\nFixed box shadow around the product on category listing\n\n1.0.0\nRelease\n", 'link' => 'http://argentotheme.com', 'download_link' => 'https://argentotheme.com/downloadable/customer/products/', 'identity_key_link' => 'https://argentotheme.com/license/customer/identity/'), 'TM_ArgentoPure' => array('code' => 'TM_ArgentoPure', 'version' => '1.0.0', 'changelog' => "\n1.0.0\nRelease\n", 'link' => 'http://argentotheme.com', 'download_link' => 'https://argentotheme.com/downloadable/customer/products/', 'identity_key_link' => 'https://argentotheme.com/license/customer/identity/'));
     }
     foreach ($modules as $moduleName => $values) {
         $values['id'] = $values['code'];
         $this->_collectedModules[$values['code']] = $values;
     }
     // calculate totals
     $this->_totalRecords = count($this->_collectedModules);
     $this->_setIsLoaded();
     // paginate and add items
     $from = ($this->getCurPage() - 1) * $this->getPageSize();
     $to = $from + $this->getPageSize() - 1;
     $isPaginated = $this->getPageSize() > 0;
     $cnt = 0;
     foreach ($this->_collectedModules as $row) {
         $cnt++;
         if ($isPaginated && ($cnt < $from || $cnt > $to)) {
             continue;
         }
         $item = new $this->_itemObjectClass();
         $this->addItem($item->addData($row));
         if (!$item->hasId()) {
             $item->setId($cnt);
         }
     }
     return $this;
 }
開發者ID:xiaoguizhidao,項目名稱:tyler-live,代碼行數:53,代碼來源:RemoteCollection.php

示例15: getConsumer

 public function getConsumer($config = null)
 {
     if (!($consumer = $this->_getData('consumer'))) {
         if ($config === null) {
             $config = $this->_getConsumerConfig();
         }
         $httpClient = new Zend_Http_Client();
         $httpClient->setAdapter($this->_getAdapter());
         if ($this->getTimeOut() > 0) {
             $httpClient->setConfig(array('timeout' => $this->getTimeOut()));
         }
         $consumer = new Zend_Oauth_Consumer($config);
         $consumer->setHttpClient($httpClient);
         $this->setData('consumer', $consumer);
     }
     return $consumer;
 }
開發者ID:CE-Webmaster,項目名稱:CE-Hub,代碼行數:17,代碼來源:Dropbox.php


注:本文中的Zend_Http_Client::setAdapter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。