socket; $this->nick = "MehBot"; //Connect to server public function cnnct() { $this->socket = fsockopen("irc.hackthissite.org", 6667); fputs($this->socket,"USER $this->nick ziandia.com XX :$this->nick \n"); fputs($this->socket,"NICK $this->nick\n"); fputs($this->socket,"JOIN #meh\n"); $this->socket = $this->socket; } } $bot = new bot; $bot->cnnct(); //Force an endless loop while(1) { while($data = fgets($bot->socket, 128)) { $ex = explode(' ', $data); echo $data; if($ex[0] == "PING"){ fputs($bot->socket, "PONG ".$ex[1]."\n"); } } } ?>