8002, )); } function route_request($request) { $uri = $request->uri; $doc_root = __DIR__ . '/www'; if (preg_match('#/$#', $uri)) { $uri .= "index.php"; } if (preg_match('#\.php$#', $uri)) { return $this->get_php_response($request, "$doc_root$uri"); } else { return $this->get_static_response($request, "$doc_root$uri"); } } } $server = new ExampleServer(); $server->run_forever();