sockets - My PHP script can't connect to an IRC server -
i can't life of me figure out doing wrong. using $sock = fsockopen("irc.esper.net", 6667)
seek connect server. i've tried using port 5555 , using server name aperture.esper.net. of fail either timeout or network not reachable error (checked logs). whole code here:
<?php set_time_limit(0); $sock = fsockopen("irc.ipv6.esper.net", 6667); echo("joined"); if (!$sock) { exit(1); } fputs($sock, "user kodas2_ :kodas2_"); fputs($sock, "nick h1a2r\r\n"); fputs($sock, "join #minecraft\r\n"); while (true) { } ?>
thanks replies.
$sock =@ fsockopen("irc.esper.net", 6667, $errno, $errstr, 30); if ($sock) { printf("no error, go on."); }
says: no error, go on.
$sock =@ fsockopen("irc.ipv6.esper.net", 6667, $errno, $errstr, 30); if (!$sock) { printf("errno: %s, errstr: %s", $errno, $errstr); }
says: errno: 0, errstr: php_network_getaddresses: getaddrinfo failed: no such host known.
so, check hosts first whether valid or not.
php sockets irc fsockopen
No comments:
Post a Comment