diff -r a21865cb1ef4 -r 173b4480c4a0 www-thermferm/utilities.php --- a/www-thermferm/utilities.php Mon Aug 18 20:00:30 2014 +0200 +++ b/www-thermferm/utilities.php Wed Aug 20 12:02:49 2014 +0200 @@ -66,6 +66,37 @@ /* + * @param string array of $commands to send to the server. + * Return: string with the complete reply from the + * server. This can be a multiline reply. + */ +function send_array($command) +{ + $sock = open_socket(); + if ($sock == false) { + return ""; + } + + foreach($command as $cmd) { + socket_write($sock, $cmd, 4096); + usleep(20000); /* Give server time to recognize lines */ + } + + $answer = ""; + while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + $answer .= $line; + } + socket_close($sock); + + return $answer; +} + + + +/* * @param string $command to send to the server. * Return: 0 = Ok. * 1 = Server responden with an error.