} if (strlen($env["REQUEST_URI"]) == 1) { $page = "index"; } else { $page = $this->fullURL; } // if(TrippingRobotSettings::devMode()){ // echo $page; // } } if (@isset($env["REQUEST_METHOD"])) { if ($env["REQUEST_METHOD"] == "POST") { $postparams = explode("=", $env["REQUEST_BODY"]); $i = 1; foreach ($postparams as $val) { if ($i & 1) { $postparams["{$val}"] = $postparams[$i + 1]; } $i++; } } } $doReturn = TrippingRobotInit::ignite($page); return array(200, array("Content-Type" => "text/html"), array($doReturn)); } } echo "TDLive.org presents\n _\n _ /_\\ | |\n __| |__ _____ _ _ ___ __| |\n|__ __| / ___| | | | |/ \\ / |\n | |__ | | | | | . | | | |\n |____| |__| |_| | |\\___/ \\____|\n |_|\nA web server for trippingrobot based on Kelpie.\n\nCopyright (c)2010-2012 dhotson.\nCopyright (c)2012-2013 TDLive.org.\n\nInitializing Kelpie.\r"; $kelpie = new Kelpie_Server(TRIPD_BIND, TRIPD_PORT); echo "Done! Listening for requests on " . TRIPD_BIND . ":" . TRIPD_PORT . ".\n"; $kelpie->start(new tripd());
* @get / */ public function home() { return 'welcome'; } /** * @get /posts/#id */ public function view($id) { return '<a href="/posts/' . $id . '/edit">Edit</a>'; } /** * @get /posts/#id/:action */ public function edit($id, $action) { return '<form action="" method="post"><input type="submit" name="test" value="blargh" /></form>'; } /** * @post /posts/#id/:action */ public function postedit($id, $action) { return 'Cool! ' . $id . '-> ' . $action; } } $server = new Kelpie_Server('0.0.0.0', 8000); $server->start(new HelloWorld());