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


PHP Zend_Controller_Request_Http::getRawBody方法代碼示例

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


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

示例1: getJsonRequestFromRequestRawBody

 /**
  * @param \Zend_Controller_Request_Http $request
  * @return array
  * @throws \Exception
  */
 protected function getJsonRequestFromRequestRawBody(\Zend_Controller_Request_Http $request)
 {
     $requestText = $request->getRawBody();
     $rpcData = json_decode($requestText, true);
     if (!is_array($rpcData)) {
         throw new \Exception("Invalid request at " . __METHOD__);
     }
     return $rpcData;
 }
開發者ID:basilicom,項目名稱:rpc-gateway,代碼行數:14,代碼來源:Gateway.php

示例2: testCallingGetRawBodyMultipleTimesShouldReturnSameValue

 /**
  * @group ZF-7756
  */
 public function testCallingGetRawBodyMultipleTimesShouldReturnSameValue()
 {
     require_once 'Zend/AllTests/StreamWrapper/PhpInput.php';
     Zend_AllTests_StreamWrapper_PhpInput::mockInput('foobar');
     $request = new Zend_Controller_Request_Http();
     $first = $request->getRawBody();
     $this->assertSame($first, $request->getRawBody());
     stream_wrapper_restore('php');
 }
開發者ID:nbcutech,項目名稱:o3drupal,代碼行數:12,代碼來源:HttpTest.php

示例3: prepareRequest

 /**
  * Process HTTP request object and prepare for token validation
  *
  * @param \Zend_Controller_Request_Http $httpRequest
  * @return array
  */
 public function prepareRequest($httpRequest)
 {
     $oauthParams = $this->_processRequest($httpRequest->getHeader('Authorization'), $httpRequest->getHeader(\Zend_Http_Client::CONTENT_TYPE), $httpRequest->getRawBody(), $this->getRequestUrl($httpRequest));
     return $oauthParams;
 }
開發者ID:,項目名稱:,代碼行數:11,代碼來源:

示例4: _fetchParams

 /**
  * Retrieve protocol and request parameters from request object
  *
  * @param string $authHeaderValue
  * @link http://tools.ietf.org/html/rfc5849#section-3.5
  * @return Mage_Oauth_Model_Server
  */
 protected function _fetchParams($authHeaderValue = null)
 {
     if (is_null($authHeaderValue)) {
         $authHeaderValue = $this->_request->getHeader('Authorization');
     }
     if ($authHeaderValue && 'oauth' === strtolower(substr($authHeaderValue, 0, 5))) {
         $authHeaderValue = substr($authHeaderValue, 6);
         // ignore 'OAuth ' at the beginning
         foreach (explode(',', $authHeaderValue) as $paramStr) {
             $nameAndValue = explode('=', trim($paramStr), 2);
             if (count($nameAndValue) < 2) {
                 continue;
             }
             if ($this->_isProtocolParameter($nameAndValue[0])) {
                 $this->_protocolParams[rawurldecode($nameAndValue[0])] = rawurldecode(trim($nameAndValue[1], '"'));
             }
         }
     }
     $contentTypeHeader = $this->_request->getHeader(Zend_Http_Client::CONTENT_TYPE);
     if ($contentTypeHeader && 0 === strpos($contentTypeHeader, Zend_Http_Client::ENC_URLENCODED)) {
         $protocolParamsNotSet = !$this->_protocolParams;
         parse_str($this->_request->getRawBody(), $bodyParams);
         foreach ($bodyParams as $bodyParamName => $bodyParamValue) {
             if (!$this->_isProtocolParameter($bodyParamName)) {
                 $this->_params[$bodyParamName] = $bodyParamValue;
             } elseif ($protocolParamsNotSet) {
                 $this->_protocolParams[$bodyParamName] = $bodyParamValue;
             }
         }
     }
     $protocolParamsNotSet = !$this->_protocolParams;
     $url = $this->_request->getScheme() . '://' . $this->_request->getHttpHost() . $this->_request->getRequestUri();
     if ($queryString = Zend_Uri_Http::fromString($url)->getQuery()) {
         foreach (explode('&', $queryString) as $paramToValue) {
             $paramData = explode('=', $paramToValue);
             if (2 === count($paramData) && !$this->_isProtocolParameter($paramData[0])) {
                 $this->_params[rawurldecode($paramData[0])] = rawurldecode($paramData[1]);
             }
         }
     }
     if ($protocolParamsNotSet) {
         $this->_fetchProtocolParamsFromQuery();
     }
     return $this;
 }
開發者ID:,項目名稱:,代碼行數:52,代碼來源:

示例5: testGetRawBodyReturnsFalseWithNoPost

 public function testGetRawBodyReturnsFalseWithNoPost()
 {
     $this->assertFalse($this->_request->getRawBody());
 }
開發者ID:lortnus,項目名稱:zf1,代碼行數:4,代碼來源:HttpTest.php


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