Some pretty code fixes and memoryleak addressing.
[mistral.git] / examples / hello_world.php
blobae68f117b96969400896dc84a215da55315a5404
1 <?php
2 function my_cool_callback($http_request) {
3 // return "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\" version=\"-//W3C//DTD XHTML 1.1//EN\" xml:lang=\"en\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title>Hello World</title></head><body><p>Your request: hest</p></body></html>";
4 /* Takes as argument: status_code, body, and all other headers. The above, string based still works too. */
5 return array('status_code' => '200 OK', 'connection' => 'close', 'content-type' => 'text/plain', 'body' => 'Hello World');
8 # Bind Webserver on all ips with port 8802, timeout > 0 == keep-alive
9 mistral_init('0.0.0.0', 6901, 0);
11 # Setup callback function which gets called after each client request
12 mistral_register_callback("my_cool_callback");
14 # Start serving
15 mistral_start();