Add REQUEST_BODY
[mistral.git] / examples / hello_world.php
blob86593abc92d8affe14dbc3213f358364c6f41f7d
1 <?php
2 function my_cool_callback($requests) {
3 /* Takes as argument: status_code, body, and all other headers. The above, string based still works too. */
4 return array('status_code' => '200 OK', 'connection' => 'close', 'content-type' => 'text/plain', 'body' => 'Hello World!');
7 $port = 8081;
9 # Bind Webserver on every ip with the port, timeout > 0 == keep-alive
10 mistral_init('0.0.0.0', $port, 0);
12 # Setup callback function which gets called after each client request
13 mistral_register_callback("my_cool_callback");
15 echo "Mistral Listening on port $port\n";
17 # Start serving
18 mistral_start();