- nl2br: documentation ( source)
- flush: documentation ( source)
- explode: documentation ( source)
- fsockopen: documentation ( source)
- fgets: documentation ( source)
- fwrite: documentation ( source)
<?php
$sock = fsockopen('irc.tl', 6667);
fwrite($sock, "NICK abcfds\n");
fwrite($sock, "USER abcfds 0 * :asd\n");
while(1) {
while ($data = fgets($sock)) {
echo nl2br($data);
flush();
$w = explode(' ', $data);
fwrite($sock,"JOIN #socktest\n");
if(isset($w[0])) {
if($w[0] == "PING") {
fwrite($sock, "PONG ".$w[1]."\n");
}
}
}
}
?>