rendered paste body<?php set_time_limit(0);class IRCConnect{ public $host = 'irc.project-x.fr'; public $port = 6667; public $nick = 'fsockopen'; public $MySocket; public $MyChannels = ''; public function __construct() { $this->MySocket = fsockopen($this->host,$this->port); $this->SendCommand('nick fsockopen'); $this->SendCommand('user fsockopen fsockopen fsockopen :PHP IRCConnect class'); Sleep(2); $this->SendCommand('JOIN #Accueil'); $this->GetCommand(); } public function SendCommand($MyCmd) { if (!empty($this->MySocket)) { fputs($this->MySocket,$MyCmd.chr(10).chr(13)); echo '[<<] '.$MyCmd.'<br />'; } } public function GetCommand() { while (1) { while ($MyData = fgets($this->MySocket,1024)) { echo '[>>] '.nl2br($MyData).'<br />'; flush(); $this->AnswerIt($MyData); } } } public function AnswerIt($MyData) { if (substr($MyData,0,4) == "PING") { $this->SendCommand('PONG '.substr($MyData,5,strlen($MyData))); } } }$IRCConnect = new IRCConnect();?>