diff --git a/create_ticket_api.php b/create_ticket_api.php index f8a824b..ef44380 100644 --- a/create_ticket_api.php +++ b/create_ticket_api.php @@ -53,6 +53,10 @@ $createTableSQL = "CREATE TABLE IF NOT EXISTS tickets ( $conn->query($createTableSQL); +// Parse input regardless of content-type header +$rawInput = file_get_contents('php://input'); +$data = json_decode($rawInput, true); + // Generate hash from stable components function generateTicketHash($data) { $stableComponents = [ @@ -91,10 +95,6 @@ if ($result->num_rows > 0) { // Force JSON content type for all incoming requests header('Content-Type: application/json'); -// Parse input regardless of content-type header -$rawInput = file_get_contents('php://input'); -$data = json_decode($rawInput, true); - if (!$data) { // Try parsing as URL-encoded data parse_str($rawInput, $data);