<?php
// Simple Health Check Script
header('Content-Type: application/json');

// Log headers
$headers = getallheaders();
$logFile = __DIR__ . '/debug_log.txt';
file_put_contents($logFile, "[HEALTH] Headers: " . json_encode($headers) . "\n", FILE_APPEND);

// Log Body
$body = file_get_contents('php://input');
file_put_contents($logFile, "[HEALTH] Body: " . substr($body, 0, 500) . "\n", FILE_APPEND);

echo json_encode([
    'status' => 'ok', 
    'message' => 'PHP is working',
    'received_headers' => $headers,
    'method' => $_SERVER['REQUEST_METHOD']
]);
