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


PHP Varien_Http_Client::setUrlEncodeBody方法代碼示例

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


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

示例1: _postRequest

 protected function _postRequest(Varien_Object $request)
 {
     if ($this->getConfigData('debug')) {
         foreach ($request->getData() as $key => $value) {
             $value = (string) $value;
             $requestData[] = strtoupper($key) . '[' . strlen($value) . ']=' . $value;
         }
         $requestData = join('&', $requestData);
         $debug = Mage::getModel('paygate/authorizenet_debug')->setRequestBody($requestData)->setRequestSerialized(serialize($request->getData()))->setRequestDump(print_r($request->getData(), 1))->save();
     }
     $client = new Varien_Http_Client();
     $_config = array('maxredirects' => 5, 'timeout' => 30);
     $_isProxy = $this->getConfigData('use_proxy', false);
     if ($_isProxy) {
         $_config['proxy'] = $this->getConfigData('proxy_host') . ':' . $this->getConfigData('proxy_port');
         //http://proxy.shr.secureserver.net:3128',
         $_config['httpproxytunnel'] = true;
         $_config['proxytype'] = CURLPROXY_HTTP;
     }
     $uri = $this->getConfigData('url');
     $client->setUri($uri)->setConfig($_config)->setMethod(Zend_Http_Client::POST)->setParameterPost($request->getData())->setHeaders('X-VPS-VIT-CLIENT-CERTIFICATION-ID: 33baf5893fc2123d8b191d2d011b7fdc')->setHeaders('X-VPS-Request-ID: ' . $request->getRequestId())->setHeaders('X-VPS-CLIENT-TIMEOUT: ' . $this->_clientTimeout);
     /*
      * we are sending request to payflow pro without url encoding
      * so we set up _urlEncodeBody flag to false
      */
     $response = $client->setUrlEncodeBody(false)->request();
     $result = Mage::getModel('paygate/payflow_pro_result');
     $response = strstr($response->getBody(), 'RESULT');
     $valArray = explode('&', $response);
     foreach ($valArray as $val) {
         $valArray2 = explode('=', $val);
         $result->setData(strtolower($valArray2[0]), $valArray2[1]);
     }
     $result->setResultCode($result->getResult())->setRespmsg($result->getRespmsg());
     if (!empty($debug)) {
         $debug->setResponseBody($response)->setResultSerialized(serialize($result->getData()))->setResultDump(print_r($result->getData(), 1))->save();
     }
     return $result;
 }
開發者ID:HelioFreitas,項目名稱:magento-pt_br,代碼行數:39,代碼來源:Pro.php

示例2: _postRequest

 /**
  * Post request to gateway and return response
  *
  * @param Varien_Object $request
  * @return Varien_Object
  */
 protected function _postRequest(Varien_Object $request)
 {
     $debugData = array('request' => $request->getData());
     $client = new Varien_Http_Client();
     $result = new Varien_Object();
     $_config = array('maxredirects' => 5, 'timeout' => 30);
     $_isProxy = $this->getConfigData('use_proxy', false);
     if ($_isProxy) {
         $_config['proxy'] = $this->getConfigData('proxy_host') . ':' . $this->getConfigData('proxy_port');
         //http://proxy.shr.secureserver.net:3128',
         $_config['httpproxytunnel'] = true;
         $_config['proxytype'] = CURLPROXY_HTTP;
     }
     $client->setUri($this->_getTransactionUrl())->setConfig($_config)->setMethod(Zend_Http_Client::POST)->setParameterPost($request->getData())->setHeaders('X-VPS-VIT-CLIENT-CERTIFICATION-ID: 33baf5893fc2123d8b191d2d011b7fdc')->setHeaders('X-VPS-Request-ID: ' . $request->getRequestId())->setHeaders('X-VPS-CLIENT-TIMEOUT: ' . $this->_clientTimeout);
     try {
         /**
          * we are sending request to payflow pro without url encoding
          * so we set up _urlEncodeBody flag to false
          */
         $response = $client->setUrlEncodeBody(false)->request();
     } catch (Exception $e) {
         $result->setResponseCode(-1)->setResponseReasonCode($e->getCode())->setResponseReasonText($e->getMessage());
         $debugData['result'] = $result->getData();
         $this->_debug($debugData);
         throw $e;
     }
     $response = strstr($response->getBody(), 'RESULT');
     $valArray = explode('&', $response);
     foreach ($valArray as $val) {
         $valArray2 = explode('=', $val);
         $result->setData(strtolower($valArray2[0]), $valArray2[1]);
     }
     $result->setResultCode($result->getResult())->setRespmsg($result->getRespmsg());
     $debugData['result'] = $result->getData();
     $this->_debug($debugData);
     return $result;
 }
開發者ID:ravi2jdesign,項目名稱:solvingmagento_1.7.0,代碼行數:43,代碼來源:Payflowpro.php

示例3: _tokenWorker

 private function _tokenWorker($token, $request)
 {
     $base64ClientID = base64_encode($this->_clientId . ":" . $this->_clientSecret);
     $client = new Varien_Http_Client();
     $result = new Varien_Object();
     $_config = array('maxredirects' => 5, 'timeout' => 5);
     $client->setUri($this->getAccessTokenEndPoint())->setConfig($_config)->setMethod(Zend_Http_Client::POST)->setParameterPost($request->getData())->setHeaders('User-Agent: Varien_Http_Client')->setHeaders('Authorization: Basic ' . $base64ClientID)->setHeaders('Accept: */*');
     try {
         $response = $client->setUrlEncodeBody(false)->request();
     } catch (Exception $e) {
         $result->setResponseCode(-1)->setResponseReasonCode($e->getCode())->setResponseReasonText($e->getMessage());
         $debugData['result'] = $result->getData();
         $this->_debug($debugData);
         throw new Mage_Exception($e->getMessage());
         return false;
     }
     $body = Mage::helper('core')->jsonDecode($response->getBody());
     $result->addData($body);
     $debugData['result'] = $result->getData();
     $this->_debug($debugData);
     if (isset($debugData['result']['error'])) {
         Mage::log($debugData['result']['error_description']);
         return false;
     }
     return $result;
 }
開發者ID:tesorogithub,項目名稱:tesoroshop,代碼行數:26,代碼來源:Paypal.php


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