getting some zone info using php
Posted: 05 Oct 2006, 10:11
hello Lapo,
I used a simple php script to connect to the sfs. I create the socket, then connect to the server, then I send some data.. but I don't get the response
here is the small script.. I used bold on the areas that might present a problem.
<?
$ip = '216.xxx.xxx.xx';
$port = 'xxxx';
/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) echo "socket_create() failed: reason: " , socket_strerror($socket) , "\n";
else echo "OK.\n";
$result = socket_connect($socket, $ip, $port);
if ($result < 0) echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
else echo "OK.\n";
$in = "<msg t='sys'><body action='verChk' r='0'><ver v='102' /></body></msg>";
$out = '';
socket_write($socket, $in, strlen($in));
while ($out = socket_read($socket, 2048)) {
echo $out;
}
socket_close($socket);
?>
I used a simple php script to connect to the sfs. I create the socket, then connect to the server, then I send some data.. but I don't get the response
here is the small script.. I used bold on the areas that might present a problem.
<?
$ip = '216.xxx.xxx.xx';
$port = 'xxxx';
/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) echo "socket_create() failed: reason: " , socket_strerror($socket) , "\n";
else echo "OK.\n";
$result = socket_connect($socket, $ip, $port);
if ($result < 0) echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
else echo "OK.\n";
$in = "<msg t='sys'><body action='verChk' r='0'><ver v='102' /></body></msg>";
$out = '';
socket_write($socket, $in, strlen($in));
while ($out = socket_read($socket, 2048)) {
echo $out;
}
socket_close($socket);
?>