/usr/share/doc/php-sabre-http-3/examples/stringify.php is in php-sabre-http-3 3.0.5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | <?php
/**
* This simple example shows the capability of Request and Response objects to
* serialize themselves as strings.
*
* This is mainly useful for debugging purposes.
*
* @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
use
Sabre\HTTP\Request,
Sabre\HTTP\Response;
// Find the autoloader
$paths = [
'/usr/share/php/sabre21/Sabre/HTTP/autoload.php';
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
__DIR__ . '/vendor/autoload.php',
];
foreach($paths as $path) {
if (file_exists($path)) {
include $path;
break;
}
}
$request = new Request('POST', '/foo');
$request->setHeaders([
'Host' => 'example.org',
'Content-Type' => 'application/json'
]);
$request->setBody(json_encode(['foo' => 'bar']));
echo $request;
echo "\r\n\r\n";
$response = new Response(424);
$response->setHeaders([
'Content-Type' => 'text/plain',
'Connection' => 'close',
]);
$response->setBody("ABORT! ABORT!");
echo $response;
echo "\r\n";
|