Files
ProjetS4COMWEB/src/API/test/request.php
2024-04-03 15:46:58 +02:00

27 lines
786 B
PHP

<?php
require_once "database.php";
$PDO = dbConnect();
$request = substr($_SERVER['PATH_INFO'], 1);
$request = explode('/', $request);
$requestRessource = array_shift($request);
$method = $_SERVER["REQUEST_METHOD"];
parse_str(file_get_contents('php://input'), $_PUT);
if($method === "GET" && isset($_GET)){ // Want tweets of a specific user
$rdvOfPraticien = dbRequestRdvPraticien($PDO, $_GET["login"]);
echo json_encode($rdvOfPraticien);
}
if($method === "POST" && isset($_POST)){
$success = CreateRDV($PDO, $_POST["login"], $_POST["date"], $_POST["time"], $_POST["lieu"]);
echo json_encode($success);
}
if($method === "DELETE" && isset($_GET)){
$id = array_shift($request);
$success = DeleteEmptyRdv($PDO, $_GET["rdv"]);
echo json_encode($success);
}