aboutsummaryrefslogblamecommitdiffstats
path: root/src/process-request.php
blob: 9c6a00609648aa5e6617760ff220d0df554f7fa1 (plain) (tree)
1
2
3
4
5
6
7
8
     





                                                       
         










                                                   

  
                                                                                                


                                                     
<?php

// SPDX-FileCopyrightText: 2024 Eilertsens Kodeknekkeri
// SPDX-FileCopyrightText: 2024 Harald Eilertsen
//
// SPDX-License-Identifier: AGPL-3.0-or-later

$data = [
    'SERVER_NAME' => $_SERVER['SERVER_NAME'],
    'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'],
    'REMOTE_PORT' => $_SERVER['REMOTE_PORT'],
    'REQUEST_METHOD' => $_SERVER['REQUEST_METHOD'],
    'REQUEST_URI' => $_SERVER['REQUEST_URI'],
    'QUERY_STRING' => $_SERVER['QUERY_STRING'],
    'REQUEST_TIME' => $_SERVER['REQUEST_TIME'],
    'REQUEST_HEADERS' => getallheaders(),
    'POST' => $_POST,
    'COOKIES' => $_COOKIE,
    'BODY' => file_get_contents('php://input'),
];

$file_name = dirname(__DIR__) . "/payloads/{$data['REQUEST_TIME']}-{$data['SERVER_NAME']}.json";
error_log("Trapped request, saving to {$file_name}");
file_put_contents($file_name, json_encode($data));
header("HTTP/1.1 404 Not Found");