<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: text/plain");
$file = __DIR__ . "/sections.json";
$data = file_get_contents("php://input");
if (!$data) {
echo "No data received.";
exit;
}
if (json_decode($data) === null) {
echo "Invalid JSON.";
exit;
}
file_put_contents($file, $data);
echo "✅ Saved successfully to sections.json";
?>