2019-03-07 20:53:21 +01:00
|
|
|
<?php
|
|
|
|
include "mqtt.php";
|
2019-03-07 21:21:42 +01:00
|
|
|
include "ascii.php";
|
|
|
|
|
2019-03-07 20:53:21 +01:00
|
|
|
$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)
|
2019-03-07 20:59:27 +01:00
|
|
|
if(trim($zeile) != "")
|
2019-03-07 21:21:42 +01:00
|
|
|
$mqtt->publish("/unhb/dfi/".$aktuelleZeile, squashCharacters(trim($zeile)), 0);
|
2019-03-07 20:59:27 +01:00
|
|
|
|
|
|
|
$aktuelleZeile = $aktuelleZeile+1;
|
2019-03-07 20:53:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$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;
|
|
|
|
?>
|