From ac52f563575f18315a028e5c73c9fe0ec2ee71e4 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Thu, 3 Sep 2020 09:26:26 +0200 Subject: [PATCH] Fix JSON handling --- sender.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sender.php b/sender.php index 83f7c1c..078b38f 100644 --- a/sender.php +++ b/sender.php @@ -10,9 +10,7 @@ use PHPMailer\PHPMailer\Exception; $mailer = new PHPMailer(true); try { - if (!$_POST) throw new Exception("There is nothing here."); - - $json = json_decode(file_get_contents('php://input')); + if (!$json = json_decode(file_get_contents('php://input'), true)) throw new Exception("There is nothing here."); if (!$json["key"]) throw new Exception("What's the code word?");