Here is my script:
$ircServer = "";
$ircPort = "6667";
$ircChannel = "#";
set_time_limit(0);
$ircSocket = fsockopen($ircServer, $ircPort, $eN, $eS);
if ($ircSocket) {
fwrite($ircSocket, "USER Lost rawr.test lol :code
");
fwrite($ircSocket, "NICK Rawr" . rand() . "
");
fwrite($ircSocket, "JOIN " . $ircChannel . "
");
while(1) {
while($data = fgets($ircSocket, 128)) {
echo nl2br($data);
flush();
// Separate all data
$exData = explode(' ', $data);
// Send PONG back to the server
if($exData[0] == "PING") {
fwrite($ircSocket, "PONG ".$exData[1]."
");
}
}
}
} else {
echo $eS . ": " . $eN;
}
I am having problem's adding a function that will Private message everyone on the IRC channel. I tried $read and other methods it does not work and IRC hangs.
NOTE: This is for educational/private purposes no harm is done or made.