Jump to content

fsockopen


sanchez77

Recommended Posts

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);
?>


Link to comment
https://forums.phpfreaks.com/topic/261641-fsockopen/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.