<?php
file_put_contents('log_cf_test.txt', json_encode([
    'time' => date('c'),
    'method' => $_SERVER['REQUEST_METHOD'],
    'headers' => getallheaders(),
    'body' => file_get_contents('php://input')
], JSON_PRETTY_PRINT), FILE_APPEND);

header('Content-Type: application/json');
echo json_encode(['status' => 'ok']);

file_put_contents("cf-log.txt", $_SERVER['REMOTE_ADDR']." | ".$_SERVER['HTTP_USER_AGENT']."\n", FILE_APPEND);
echo json_encode(["status"=>"ok"]);