req_isjson(), 'method' => req_method(['GET','POST']), 'path' => $_SERVER['PATH_INFO'] ?? '/', 'post' => $post, ]; $res = (object)[ 'result' => 'ok', 'req' => $req, ]; header('Content-Type: application/json'); echo json_encode([$res], JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);