Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Minimal REST endpoint in plain PHP header("Content-Type: application/json"); $method = $_SERVER["REQUEST_METHOD"]; $path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); if ($method === "GET" && $path === "/api/users") { echo json_encode(["data" => getUsers()]); } else { http_response_code(404); echo json_encode(["error" => "Not found"]); }
Result
Open