Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2.  
  3. $host = "irc.focogaming.com";
  4. $port = 6667;
  5. $nick = "JamesPHP";
  6. $ident = "JamesPHP";
  7. $channel = "#exotic";
  8. $readbuffer = "";
  9. $realname = "James PHP - PHP bot";
  10. $connected = 0;
  11. $fp = fsockopen($host, $port, $erno, $errstr, 30);
  12.  
  13. if (!$fp)
  14. {
  15.     echo $errstr." (".$errno.")<br />\n";
  16. }
  17. else
  18. {
  19.     if($connected == 0) {
  20.     fwrite($fp, "NICK ",.$nick."\r\n");
  21.     fwrite($fp, "USER ".$ident." ".$host." bla :".$realname."\r\n");
  22.     }
  23.     fwrite($fp, "JOIN ",.$channel."\r\n");
  24.    
  25.     fwrite($fp, "PRIVMSG ".$channel." :JamesPHP Alpha build loading...\r\n");
  26.     fwrite($fp, "PRIVMSG ".$channel." :Ready to go!\r\n");
  27.    
  28.     while (!feof($fp)) {
  29.  
  30.         $line =  fgets($fp, 128);
  31.         echo $line."\n";
  32.  
  33.         $line = explode(":ping ", $line);
  34.  
  35.         echo $line[0]."\n";
  36.  
  37.         if ($line[1]) {
  38.  
  39.             fwrite($fp, "PONG ".$line[1]."\r\n");
  40.         }
  41.  
  42.     }
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement