$request = \Slim\Slim::getInstance()->request(); $commentary = json_decode($_POST["json"]); $commentaryDAO = new Commentary(); $result = $commentaryDAO->listall($commentary); if (sizeof($result) > 0) { $result["success"] = true; } else { $result["success"] = false; } echo json_encode($result); }); $app->put('/commentary', function () { $request = \Slim\Slim::getInstance()->request(); $commentary = json_decode($request->getBody()); $commentaryDAO = new Commentary(); $commentaryDAO->update($commentary); echo '{"result":"ok"}'; }); $app->delete('/commentary', function () { $request = \Slim\Slim::getInstance()->request(); $commentary = json_decode($request->getBody()); $commentaryDAO = new Commentary(); $commentaryDAO->delete($commentary); echo '{"result":"ok"}'; }); $app->post('/picture/getbyplace', function () { $request = \Slim\Slim::getInstance()->request(); //$picture = json_decode($request->getBody()); $picture = json_decode($_POST["json"]); $pictureDAO = new Picture(); //$pictureDAO->getByPlace($picture);