32 lines
942 B
PHP
32 lines
942 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
|
require_once dirname(__DIR__) . '/bootstrap.php';
|
|
|
|
$requestUri = (string) ($_SERVER['REQUEST_URI'] ?? '');
|
|
$requestPath = (string) (parse_url($requestUri, PHP_URL_PATH) ?: '');
|
|
$prefix = '/api/boersenchecker/index.php/';
|
|
$relativePath = trim((string) ($_GET['path'] ?? ''), '/');
|
|
|
|
if ($relativePath === '') {
|
|
$relativePath = str_starts_with($requestPath, $prefix)
|
|
? substr($requestPath, strlen($prefix))
|
|
: ltrim((string) ($_SERVER['PATH_INFO'] ?? ''), '/');
|
|
}
|
|
|
|
$normalized = strtolower(trim($relativePath, '/'));
|
|
|
|
if ($normalized === 'v1/chart-data') {
|
|
require __DIR__ . '/chart_data.php';
|
|
return;
|
|
}
|
|
|
|
http_response_code(404);
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode([
|
|
'ok' => false,
|
|
'message' => 'Ressource nicht gefunden.',
|
|
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|