ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
stringify.php
Go to the documentation of this file.
1 <?php
2 
15 
16 // Find the autoloader
17 $paths = [
18  __DIR__ . '/../vendor/autoload.php',
19  __DIR__ . '/../../../autoload.php',
20  __DIR__ . '/vendor/autoload.php',
21 
22 ];
23 foreach ($paths as $path) {
24  if (file_exists($path)) {
25  include $path;
26  break;
27  }
28 }
29 
30 $request = new Request('POST', '/foo');
31 $request->setHeaders([
32  'Host' => 'example.org',
33  'Content-Type' => 'application/json'
34  ]);
35 
36 $request->setBody(json_encode(['foo' => 'bar']));
37 
39 echo "\r\n\r\n";
40 
41 $response = new Response(424);
42 $response->setHeaders([
43  'Content-Type' => 'text/plain',
44  'Connection' => 'close',
45  ]);
46 
47 $response->setBody("ABORT! ABORT!");
48 
50 
51 echo "\r\n";
$path
Definition: aliased.php:25
The Request class represents a single HTTP request.
Definition: Request.php:18
foreach($paths as $path) $request
Definition: stringify.php:30
$paths
Definition: stringify.php:17
This class represents a single HTTP response.
Definition: Response.php:12
$response
Definition: stringify.php:41