I would like to declare multiple variables using the output of my script and the stream_get_line php function.
Example:
<?php
$fp = fsockopen("10.73.xxx.xxx", "23");
fputs($fp,"user\r");
sleep(1);
fputs($fp,"password\r");
sleep(1);
$content = stream_get_line($fp, 100, "user");
$content2 = stream_get_line($fp, 100, "password");
echo $content;
echo $content2;
?>
However, the script stops working after I use the stream_get_line once. How can I use it multiple times to grab multiple lines of output? It works fine if I remove the second stream_get_line function.
I ended up using the following code:
I store the whole thing in the variable “content” and then build 2 extra variables “content1” and “content2”, where I pull the desired output from the variable “content”.