I just want a simple way of seeing what the last two lines in the Telnet stream were. For instance, if you can imagine a Terminal window, I just want to be able to type a command, hit enter, then see what the response is. So far, I can execute the command, but I'm having trouble evaluating the response. Rather than just the two lines of response being returned, stream_get_line
returns every line from the stream.
Can anyone suggest a function or possibly a better way to write it?
$con = @pfsockopen("10.30.96.55", 23, $errno, $errstr, 30);
fputs($con, "ipaddress get");
while (!feof($con)) {
$response = stream_get_line($con, 100, "
");
}
echo $response;
It may be that I don't completely understand stream_get_line()
; if I'm doing something dumb, someone please help me out. Thanks!