api
This commit is contained in:
43
api/router.v1.php
Normal file
43
api/router.v1.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// /api/router.v1.php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// Pfad erneut auslesen
|
||||
$uri = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
|
||||
$path = rtrim($uri, '/');
|
||||
|
||||
// Namespace v1
|
||||
switch ($path) {
|
||||
case '/v1/quickcheck':
|
||||
require __DIR__ . '/v1/target/quickcheck.php'; // dein bestehendes File
|
||||
if (!function_exists('quickcheck_handle_request')) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['ok' => false, 'error' => 'Handler quickcheck_handle_request not found']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = quickcheck_handle_request();
|
||||
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||
break;
|
||||
|
||||
case '/v1/browser.quick.test':
|
||||
require __DIR__ . '/v1/result/browser.quick.test.php';
|
||||
if (!function_exists('browser_quick_test_handle_request')) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['ok' => false, 'error' => 'Handler browser_quick_test_handle_request not found']);
|
||||
exit;
|
||||
}
|
||||
|
||||
browser_quick_test_handle_request();
|
||||
break;
|
||||
|
||||
default:
|
||||
http_response_code(404);
|
||||
echo json_encode([
|
||||
'ok' => false,
|
||||
'error' => 'Unknown v1 endpoint',
|
||||
'path' => $path,
|
||||
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||
break;
|
||||
}
|
||||
Reference in New Issue
Block a user