本文整理汇总了PHP中Mage_Core_Controller_Request_Http::getRawBody方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http::getRawBody方法的具体用法?PHP Mage_Core_Controller_Request_Http::getRawBody怎么用?PHP Mage_Core_Controller_Request_Http::getRawBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Controller_Request_Http
的用法示例。
在下文中一共展示了Mage_Core_Controller_Request_Http::getRawBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _fetchParams
/**
* Retrieve protocol and request parameters from request object
*
* @link http://tools.ietf.org/html/rfc5849#section-3.5
* @return Mage_Oauth_Model_Server
*/
protected function _fetchParams()
{
$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;
}