本文整理汇总了PHP中Sabre_HTTP_Request::getBody方法的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_HTTP_Request::getBody方法的具体用法?PHP Sabre_HTTP_Request::getBody怎么用?PHP Sabre_HTTP_Request::getBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre_HTTP_Request
的用法示例。
在下文中一共展示了Sabre_HTTP_Request::getBody方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDefaultInputStream
function testDefaultInputStream()
{
$h = fopen('php://memory', 'r+');
fwrite($h, 'testing');
rewind($h);
$previousValue = Sabre_HTTP_Request::$defaultInputStream;
Sabre_HTTP_Request::$defaultInputStream = $h;
$this->assertEquals('testing', $this->request->getBody(true), 'We didn\'t get our testbody back');
Sabre_HTTP_Request::$defaultInputStream = $previousValue;
}
示例2: httpReport
/**
* HTTP REPORT method implementation
*
* Although the REPORT method is not part of the standard WebDAV spec (it's from rfc3253)
* It's used in a lot of extensions, so it made sense to implement it into the core.
*
* @param string $uri
* @return void
*/
protected function httpReport($uri)
{
$body = $this->httpRequest->getBody(true);
$dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
$reportName = Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild);
if ($this->broadcastEvent('report', array($reportName, $dom, $uri))) {
// If broadcastEvent returned true, it means the report was not supported
throw new Sabre_DAV_Exception_ReportNotImplemented();
}
}
示例3: httpReport
/**
* HTTP REPORT method implementation
*
* Although the REPORT method is not part of the standard WebDAV spec (it's from rfc3253)
* It's used in a lot of extensions, so it made sense to implement it into the core.
*
* @return void
*/
protected function httpReport()
{
$body = $this->httpRequest->getBody(true);
//We'll need to change the DAV namespace declaration to something else in order to make it parsable
$body = preg_replace("/xmlns(:[A-Za-z0-9_]*)?=(\"|\\')DAV:(\"|\\')/", "xmlns\\1=\"urn:DAV\"", $body);
$errorsetting = libxml_use_internal_errors(true);
libxml_clear_errors();
$dom = new DOMDocument();
$dom->loadXML($body);
$dom->preserveWhiteSpace = false;
$namespaceUri = $dom->firstChild->namespaceURI;
if ($namespaceUri == 'urn:DAV') {
$namespaceUri = 'DAV:';
}
$reportName = '{' . $namespaceUri . '}' . $dom->firstChild->localName;
if ($this->broadcastEvent('report', array($reportName, $dom))) {
// If broadcastEvent returned true, it means the report was not supported
throw new Sabre_DAV_Exception_ReportNotImplemented();
}
}