Use raw JSON input

This commit is contained in:
Kumi 2020-09-03 08:50:20 +02:00
parent 1dddd7b07e
commit 79e3fd93c2

View file

@ -10,9 +10,9 @@ use PHPMailer\PHPMailer\Exception;
$mailer = new PHPMailer(true);
try {
if (!$_POST || !$data=$_POST["data"]) throw new Exception("There is nothing here.");
if (!$_POST) throw new Exception("There is nothing here.");
$json = json_decode($data, true);
$json = json_decode(file_get_contents('php://input'));
if (!$json["key"]) throw new Exception("What's the code word?");