verbessert, evt

This commit is contained in:
belevo\mh
2024-11-04 15:13:19 +01:00
parent 7ddb8936d4
commit 0ed1cb0a71
2 changed files with 5 additions and 32 deletions

View File

@@ -130,45 +130,18 @@ return $json;
private function SendJsonToInfluxDB($url, $json)
{
// $token = "Token iFNTONC5UvST8GT5itWqxiO6m4O1yHt5hus54J8eqotk5IZiq0Wjd0_Xi6dozmo32QR3esJqk6hJAvJ8X2SxtQ==";
/*
if (empty($token)) {
IPS_LogMessage("Belevo_Server_Kommunikation", "InfluxDB-Token fehlt->SendJsonToInfluxDB");
return;
}*/ /*
// Header für die Anfrage definieren
$headers = [
"Content-Type: application/json",
//"Authorization: Bearer $token" // Wenn der Token gebraucht wird, füge ihn hier hinzu
"id: test" // Die ID, die vom Flask-Server überprüft wird
];
// Optionen für den HTTP-Request definieren
$options = [
'http' => [
'header' => implode("\r\n", $headers),
'method' => 'POST',
'content' => $json, // Hier wird das JSON im Body gesendet
],
];
*/
/*
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => $json
],
];*/
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n".
"id: test\r\n",
'method' => 'POST',
'content' => $json // JSON-Inhalt im Body der Anfrage
],
];
IPS_LogMessage("Belevo_Server_Kommunikation", "Options: " . print_r($options, true));