sanchez77 Posted April 26, 2012 Share Posted April 26, 2012 I am trying to open a Unix server and was wondering how would you return what the Unix server is saying, ie the prompt? Here is the code I was using after reading the php.net. The $call variable is my attempt at reading the server and have it return what it says. I do have a connection to the server cause if I change the address or port number, i have the error in the log file saying the address refused the connection. Any help/insight is really appreciated. Thanks <?php $host = "127.0.0.1"; $port = 9595; $fp = stream_socket_client("tcp://".$host.":".$port."", $errno, $errstr, 30); $call = fgets($fp); echo $call; fclose($fp); ?> Quote Link to comment https://forums.phpfreaks.com/topic/261641-fsockopen/ Share on other sites More sharing options...
sanchez77 Posted April 26, 2012 Author Share Posted April 26, 2012 sorry, code on the brain. It's really not fsockopen, it's stream_socket_client, but i tried fsockopen as well <?php $host = "127.0.0.1"; $port = 9595; $fp = fsockopen($host, $port, $errno, $errstr, 30); $call = fgets($fp); echo $call; fclose($fp); ?> Quote Link to comment https://forums.phpfreaks.com/topic/261641-fsockopen/#findComment-1340685 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.