$strip = explode("?", $strip); if (count($strip) > 0) { return $strip[0]; } return NULL; } switch ($request_method) { case 'get': $result = $query->getResults(new stdClass(), $_SESSION['comune']); if (isset($_SESSION['comune'])) { unset($_SESSION['comune']); } break; case 'put': $put = file_get_contents("php://input", 'r'); $params = json_decode($put); $result = $query->updateRecords($params); break; case 'post': $put = file_get_contents("php://input", 'r'); $params = json_decode($put); $result = $query->createRecord($params); break; case 'delete': $id = get_url_id(); $params = new stdClass(); $params->id = $id; $result = $query->destroyRecord($params); break; } echo json_encode($result);