some networks do not allow instant channel join so you would have to use a while loop before you join the channel with a sleep in it and some pong back inorder not to get disconnected from server
while($logincount < 10) {
$logincount++;
$data = fgets($socket, 128);
echo nl2br($data);
// Separate all data
$ex = explode(' ', $data);
// Send PONG back to the server
if($ex[0] == "PING"){
fputs($socket, "PONG ".$ex[1]."\n");
}
flush();
}
sleep(1);
this should be placed right under the :
fputs($socket,"NICK $nick\n");
NOTE to furby :I guess you should use some sleep commands inorder to save the pain from cpu leaks and server pressure a "sleep(1);" would be good but if you want you can use "usleep():" for milliseconds:)