I've made a successful IRC bot using PHP 4.0.2-dev and MySQL but I'm having a slight issue sending data out. For instance if I use a command that somebody msgs me to msg them back 10 times, it might msg them 2 or 3 times then when they call the commnad again it'll send 2 or 3 more lines from the previous command, so on and so forth. It seems like the output data is getting stuck in a que. I've tried using fflush($socket) but it's not helping. If you have any experience with this issue please reply. Thanks in advance.
fsockopen() with IRC
A good site you might be able to model your bot after is on phpwizard.net. They have some sweet stuff there none the less, but an entire library of functions for printing out to irc w/ their irc program. Enjoy.
Chuck,
Thanks. Actually I know Yapa who runs phpwizard.net so naturally that was my first place to check. I've ripped through his entire phpIRC code and have found nothing that I need. My issue is when I try to send out simultaneous msgs to a channel or person which he doesn't have code on because his IRC program would only send out 1 message at a time. I even reported it as a bug on bugs.php.net and got a reply telling me to use fflush() to flush the buffer but that doesn't do a thing. Thanks for your time.
-Feti Chico
How did you get the sockets workin right? i'm kinda a newbie to pHp, and i cant do it worth a @!#$, i been looking gor a socket tutorial for a bot, or something of the like, i've already got perl sockets down, i just need the pHp sockets, please don't post, if you reply at all, just e-mail me, thanx
Matt
Matt,
It's fairly simple to make an IRC connection and send data. What you need I think is the RCF 1459. Go to Yahoo and type 'RFC 1459' and get the IRC RFC. Here's a quick example of PHP's connection to IRC.
$sock = fopen("irc.server.com","port");
fputs($sock,"USER ident username server :realname\n");
fputs($sock,"NICK nickname\n");
fputs($sock,"JOIN #channel\n");
while (!feof($sock)) {
echo $fgets($sock,1024);
}
fclose($sock);
-Sean aka Feti Chico
@#php EfNet
Is it really that simple to reply to a PRIVMSG ? I have figuerd it out how to connect and send msg with
fputs($irc, "PRIVMSG NICK :HELLO \n");
but have u any ide how to reply to example if i get this !hi then i would reply with fputs($irc, "PRIVMSG The_use_who_said_!hi :HELLO \n"); is there a way to do it ?