<?php
header('Content-Type: application/json');
$data = file_get_contents('php://input');
$jsonData = json_decode($data, true);
if ($jsonData) {
file_put_contents('xxx.json', json_encode($jsonData, JSON_PRETTY_PRINT));
echo json_encode(['status' => 'success']);
} else {
echo json_encode(['status' => 'error', 'message' => 'Invalid JSON data']);
}
?>