Add REQUEST_BODY
[mistral.git] / examples / formtest.php
blobea8352acd4c1d27cfcf934a888a2e329dba1f159
1 <?php
2 function my_cool_callback($requests) {
3 $requests['HTTP_CONNECTION'] = isset($requests['HTTP_CONNECTION']) ? $requests['HTTP_CONNECTION'] : 'close';
5 $output = '<form method="post" enctype="multipart/form-data"><input type="text" name="test_txt_fld" /><input type="hidden" name="test_hdn_fld" value="foobar" /><input type="file" name="testfile" /><input type="submit" /></form>';
6 $output .= nl2br(print_r($requests, true));
8 $answer = array('status_code' => '200 OK',
9 'connection' => $requests['HTTP_CONNECTION'],
10 'content-type' => 'text/html',
11 'content-length' => strlen($output),
12 'body' => $output);
13 return $answer;
16 $port = 8081;
18 # Bind Webserver on all ips with the port, timeout > 0 == keep-alive
19 mistral_init('0.0.0.0', $port, 2);
21 # Setup callback function which gets called after each client request
22 mistral_register_callback("my_cool_callback");
24 echo "Mistral Listening on port $port\n";
26 # Start serving
27 mistral_start();