<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $input = file_get_contents('php://input');
    $data = json_decode($input, true);
    
    $logEntry = date('Y-m-d H:i:s') . ' - ' . json_encode($data) . "\n";
    file_put_contents('api_logs.txt', $logEntry, FILE_APPEND | LOCK_EX);
    
    echo json_encode(['status' => 'logged']);
}
?>