<?php include "mqtt.php"; include "ascii.php"; $html = file_get_contents("send.html"); if($_REQUEST['text'] != "") { $mqtt = new phpMQTT("192.168.88.243", 1883, "dynPHPClient"); if ($mqtt->connect(true, NULL, NULL, NULL)) { $zeilen = explode("\n", $_REQUEST['text']); $aktuelleZeile = 1; foreach ($zeilen as $zeile) { if($aktuelleZeile <= 4) if(trim($zeile) != "") $mqtt->publish("/unhb/dfi/".$aktuelleZeile, squashCharacters(trim($zeile)), 0); $aktuelleZeile = $aktuelleZeile+1; } $mqtt->close(); $html = str_replace("%%status%%", "<h2><b>Dein Text wurde erfolgreich gesendet.</b></h2>", $html); } else { echo "Time out!\n"; } }else{ $html = str_replace("%%status%%", "", $html); } echo $html; ?>