From 4067678f6bb525bebad68060885d8a4cfbc38927 Mon Sep 17 00:00:00 2001 From: "belevo\\mh" Date: Wed, 16 Oct 2024 08:25:24 +0200 Subject: [PATCH] =?UTF-8?q?HTTP/1.1=20400=20BAD=20REQUEST=20=20Fehler=20wo?= =?UTF-8?q?m=C3=B6glich=20behoben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Belevo_Server_Kommunikation/module.php | 11 +++++++---- library.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Belevo_Server_Kommunikation/module.php b/Belevo_Server_Kommunikation/module.php index 5eb88f1..693f468 100644 --- a/Belevo_Server_Kommunikation/module.php +++ b/Belevo_Server_Kommunikation/module.php @@ -132,13 +132,16 @@ return $json; IPS_LogMessage("Belevo_Server_Kommunikation", "InfluxDB-Token fehlt->SendJsonToInfluxDB"); return; }*/ + $headers = [ + "Content-Type: application/json", + //"Authorization: Bearer $token" // Wenn der Token gebraucht wird, füge ihn hier hinzu + ]; + $options = [ 'http' => [ - 'header' => "Content-Type: application/json\r\n". - "daten: $json". - "id: test\r\n", + 'header' => implode("\r\n", $headers), 'method' => 'POST', - + 'content' => $json, // Hier wird das JSON im Body gesendet ], ]; $context = stream_context_create($options); diff --git a/library.json b/library.json index b7c0953..858bcee 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "7.1" }, - "version": "0.38", + "version": "0.39", "build": 0, "date": 0 } \ No newline at end of file