Currently I am making a IRC that sends a message onto the IRC main channel. Here is my code:
<?php
$ircServer = "xxxx";
$ircPort = "6667";
$ircChannel = "#bots";
set_time_limit(0);
$msg = $_GET['msg'];
$ircSocket = fsockopen($ircServer, $ircPort, $eN, $eS);
if ($ircSocket)
{
fwrite($ircSocket, "USER Lost rawr.test lol :code\n");
fwrite($ircSocket, "NICK Rawr" . rand() . "\n");
fwrite($ircSocket, "JOIN " . $ircChannel . "\n");
fwrite($ircSocket, "PRIVMSG " . $channel . " :" . $msg = $_GET['msg'] . "\n");
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]."\n");
}
}
echo $eS . ": " . $eN;
}
}
?>
<html><body>
<h4>IRC Bot Tester</h4>
<form action="irc.php" method="post">
Command: <input type="text" name="msg" />
<input type="submit" />
</form>
</body></html>
My problem is the BOT is not sending any messages to the channel, as you see I used post + get data for the message info sent to the channel.
Here is the log what I recieve:
:irc.underworld.no 366 Rawr30517 #bots :End of /NAMES list. :irc.underworld.no 411 Rawr30517 :No recipient given (PRIVMSG) : 0: 0PING :irc.underworld.no
I do not know which part causes the this:
recipient given (PRIVMSG) : 0: 0PING
Thanks if anyone could help me. I am trying to simply post a message to the bot and the bot delivers the message to the main channel.
To:
Change:
To: