- <?
- // define your variables
- $host = "irc.freesteam.org";
- $port=6667;
- $nick="n3t-Bot";
- $ident="n3tBot";
- $chan="#n3t-t3z";
- $readbuffer="";
- $realname = "plsufag";
- // open a socket connection to the IRC server
- $fp = fsockopen($host, $port, $errno, $errstr, 30);
- // print the error if there is no connection
- if (!$fp) {
- echo $errstr." (".$errno.")<br />\n";
- } else {
- // write data through the socket to join the channel
- fwrite($fp, "NICK ".$nick."\r\n");
- fwrite($fp, "USER ".$ident." ".$host." bla :".$realname."\r\n");
- fwrite($fp, "JOIN :".$chan."\r\n");
- // write data through the socket to print text to the channel
- fwrite($fp, "PRIVMSG ".$chan." :Hello There!\r\n");
- fwrite($fp, "PRIVMSG ".$chan." :I am a bot\r\n");
- // loop through each line to look for ping
- while (!feof($fp)) {
- $line = fgets($fp, 128);
- echo $line."<br />\n";
- $line = explode(":ping ", $line);
- echo $line[0]."<br />\n";
- if ($line[1]) {
- fwrite($fp, "PONG ".$line[1]."\r\n");
- }
- flush();
- }
- fclose($fp);
- }
- ?>
Posted by php bot on Tuesday 21st April 2009 23:46:07 - Never Expires
download | new post
Submit a correction or amendment below. (click here to post a fresh rage)
After submitting an amendment, you'll be able to view the differences between the old and new rage easily.