'invalid JSON', 'raw' => 'EMPTY']); exit; } // --- Decode JSON $input = json_decode($raw, true); // --- Cek error JSON if (json_last_error() !== JSON_ERROR_NONE) { http_response_code(400); echo json_encode(['status' => 'invalid JSON', 'raw' => $raw]); exit; } // --- Simpan ke file log $log_file = __DIR__ . '/tracking_log.txt'; file_put_contents($log_file, date('c') . ' - ' . json_encode($input) . PHP_EOL, FILE_APPEND); // --- Balas sukses echo json_encode(['status' => 'ok']);