Hallo, PHPpeople. My name is Tasos and i am trying to connect to an irc server using fsockopen().
There is my code:
<?php
$server_socket = fsockopen ("someServer.irc.gr", 6667, $errno, $errstr, 30);
if (!$server_socket)
{
echo "$errstr ($errno)";
}
else
{
for ($i = 0; $i <= 4; $i++)
{
$buffer = fgets($server_socket, 4096);
echo "$buffer\n<br>";
}
$my_mes1 = fputs ($server_socket, "USER myname . . myname");
$my_mes2 = fputs ($server_socket, "PONG :someServer.irc.gr");
$my_mes3 = fputs ($server_socket, "nick myname");
$buffer = fgets($server_socket, 4096);
echo "$buffer\n<br>";
print $my_mes1 $my_mes2 $my_mes3;
fclose ($server_socket);
}
?>
The problem is that although the program connects to the server and although it gets the first 4 "welcome" messages, when i try to send (fputs) data to the server i get a "connection failed error".
Note: I telneted the someServer.irc.gr using the rfc 1459 commands with the above order and i was normaly connected.
Any ideas??
Thanx!