Created
February 24, 2022 22:10
-
-
Save derak-kilgo/7b67e0582ab53c4c88bcc2b12fccd8dd to your computer and use it in GitHub Desktop.
post2log - tool to debug anything that sends data via POST request with php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = __DIR__ . DIRECTORY_SEPARATOR . 'post2log.txt'; | |
$post = $_POST; | |
if(!empty($post)){ | |
$post['timestamp'] = date('r'); | |
file_put_contents($file,print_r($post,true),FILE_APPEND); | |
http_response_code(202); | |
print_r($post); | |
}else{ | |
http_response_code(405); | |
echo "This endpoint only accepts post requests"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment