Add REQUEST_BODY
[mistral.git] / examples / return_vars.php
blobdb0c6bd7f9e9f2dafd965904604a55a479e8ae28
1 <?php
2 function my_cool_callback($requests) {
3 $requests['HTTP_CONNECTION'] = isset($requests['HTTP_CONNECTION']) ? $requests['HTTP_CONNECTION'] : 'close';
5 $output = print_r($requests, true);
7 $answer = array('status_code' => '200 OK',
8 'connection' => $requests['HTTP_CONNECTION'],
9 'content-type' => 'text/plain',
10 'content-length' => strlen($output),
11 'body' => $output);
12 return $answer;
15 $port = 8081;
17 # Bind Webserver on all ips with port 8081, timeout > 0 == keep-alive
18 mistral_init('0.0.0.0', $port, 2);
20 # Setup callback function which gets called after each client request
21 mistral_register_callback("my_cool_callback");
23 echo "Mistral Listening on port $port\n";
25 # Start serving
26 mistral_start();