include "Telnet.php"; ?> </head> <body> <?php $requestMsg = $_POST['request']; $responseMsg = 'Welcome'; try { $telnet = new Telnet('192.168.0.12', 4444); $telnet->setPrompt("\n"); if (!isset($requestMsg)) { $requestMsg = "getStatus"; } $responseMsg = $telnet->exec($requestMsg); } catch (Exception $e) { $responseMsg = 'Exception: ' . $e->getMessage(); } $responseMsg = str_replace("\r\n", '', $responseMsg); ?> <form action="" method="POST"> <?php if ($responseMsg == "stopped") { ?> <div> Start indexing <input type="submit" name="request" value="startIndexing"/> </div> <?php } else {
$t10 = $t / 10; $thnames = array(1 => "THAussen", 2 => "THSchlaf", 3 => "THAndreas", 4 => "THBad"); $thName = $thnames[$c]; if ($useTelnet) { if ($DEBUG) { print "<br>### using telnet ###<br>"; } //send data to fhem $telnet = new Telnet('192.168.0.40', 7072); $result = $telnet->connect(); if ($DEBUG) { print "<br>telnet connect: " . $result . "<br>"; } //lueften_ja berechnen und setzen if ($result) { $telnet->exec('setreading ' . $thName . ' T ' . $t10 . "\r\n", $result); // NOTE: $result may contain newlines if ($DEBUG) { print $result; } $telnet->exec('setreading ' . $thName . ' H ' . $h . "\r\n", $result); if ($DEBUG) { print '<br>setreading: ' . $result . '<br'; } // say Disconnect(0); to break the connection without explicitly logging out $telnet->disconnect(); } else { if ($DEBUG) { print "<br>telnet connect failed: " . $result . '<br>'; } }