3 $requestBody = file_get_contents('php://input');
5 $requestJson = json_decode($requestBody, true);
7 if (empty($requestJson['index'])) {
8 throw new \Exception('index is required.');
11 $jsonFile = __DIR__.'/tablediffs.json';
13 $demoStorage = json_decode(file_get_contents($jsonFile), true);
15 if (!array_key_exists($requestJson['index'], $demoStorage)) {
16 throw new \Exception('index not found.');
19 $targetDemo = $demoStorage[$requestJson['index']];
21 header('Content-Type: application/json');
22 echo json_encode($targetDemo);