Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connect IRC using php on linux systems
#4
I'm posting what i'm using for windows for connecting IRC using php :
PHP Code:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<
style type="text/css">html{background:#000;color:#0F0;font:Verdana, Geneva, sans-serif;font-size:12px;}</style>
</head>
<
body>
<?
php
    
//Configuration
    
$nick "Spl3enBot";
    
$user "Spl3en";
    
$channel "#whatever";
    
$server "irc.server.net";

    
//Begin of the script
    
$socket socket_create(AF_INETSOCK_STREAMSOL_TCP);
    
$result socket_connect($socketgethostbyname($server), 6667);
    
$in "NICK ".$nick."\r\n";
    
$in .= "USER  ".$user." 8 *  : ".$user."\r\n";
    
$in .= "USERHOST Userhost\r\n";
    
$in .= "JOIN :".$server."\r\n";
    
socket_write($socket$instrlen($in));
    while (
$out socket_read($socket1024)){
        if (
preg_match("/PING/i",$out)) socket_write($socket,"PONG ",strlen("PONG "));
        echo 
"<font color=blue>Socket_read = <i>".$out."</i></font><br>";
    }
    
socket_close($socket);
?>
</body></html> 

Hope it helps Smile
Reply


Messages In This Thread
Connect IRC using php on linux systems - by immi - 10-13-2009, 02:27 AM
RE: Connect IRC using php on linux systems - by Spl3en - 10-13-2009, 06:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP Framework List: An Ultimate Guide to 102 PHP Frameworks for Web Developers tk-hassan 0 941 07-27-2020, 11:26 PM
Last Post: tk-hassan
  PHP Video Tutorials (PHP For Beginners) Eleqtriq 4 3,668 10-10-2011, 01:00 PM
Last Post: Greyersting
  Could not connect: Access denied for user 'root'@'localhost' nevets04 5 4,462 02-03-2011, 04:52 PM
Last Post: Gaijin

Forum Jump:


Users browsing this thread: 2 Guest(s)