Here is what I'm trying to do... I'm trying to output the result after a "fput" execution is completed. It's a fsockopen()
not a file. I can display the whole connection so far, But I don't want to see the whole connection, here is what I have so far:
$tftp = fsockopen("1.1.1.1", 21, $errno, $errstr, 5) or die("Connection failed.");
socket_set_blocking($tftp, true);
$user = fputs($tftp, "USER username\n");
$pass = fputs($tftp, "PASS password\n");
$ginfo = fputs($tftp, "SITE who\n");
fputs($tftp, "quit\n");
sleep(2);
#while(substr(strrchr($buffer, "T USERNAME"), 0)) {
while(!strstr($buffer,"Goodbye")) {
$buffer = fgets($tftp, 128);
}
fclose($tftp);
}
The !strstr is to kill the while loop when it sees "Goodbye". The Commented while statement is a attempt to start the echo'ing at "T USERNAME" But i get nothing back. and yes "T USERNAME" is in the display...
So what i'm aiming at, is to display ONLY what comes after, $ginfo = fputs($tftp, "SITE who\n");
is this possible? and if not, why doesn't my strrchr work?