From fc6b1966e3b08f00732fbb5b24e6abdf7da02eec Mon Sep 17 00:00:00 2001 From: Emiliano Macedonio Date: Tue, 21 May 2024 16:55:59 +0200 Subject: [PATCH] Added the possibility of sending data to the "qso" method API also in www-x-form-urlencoded format to allow the automatic sending of QSOs via software such as Log4OM --- application/controllers/Api.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/application/controllers/Api.php b/application/controllers/Api.php index f1edde37..7bb18b5a 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -193,8 +193,13 @@ class API extends CI_Controller { // Decode JSON and store $obj = json_decode(file_get_contents("php://input"), true); if ($obj === NULL) { - echo json_encode(['status' => 'failed', 'reason' => "wrong JSON"]); - die(); + // Decoding not valid try simple www-x-form-urlencoded + $objTmp = file_get_contents("php://input"); + parse_str($objTmp, $obj); + if ($obj === NULL) { + echo json_encode(['status' => 'failed', 'reason' => "wrong JSON"]); + die(); + } } if(!isset($obj['key']) || $this->api_model->authorize($obj['key']) == 0) {