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"); } //Respond to PINGS public function ping($response) { fputs($this->socket, "PONG ".$response."\n"); } } class cmds extends bot { public function sayit($channel) { fputs($this->socket, "PRIVMSG ".$channel." :Test meh!\n"); } } //Create bot object and connect $bot = new bot; $bot->cnnct(); //Create new object to deal with commands $cmds = new cmds; //Force an endless loop while(1) { while($data = fgets($bot->socket, 128)) { //Seperate data $ex = explode(' ', $data); echo $data; //Respond to PINGS if($ex[0] == "PING") $bot->ping($ex[1]); if($ex[3] == ":!sayit") $cmds->sayit($ex[2]); } } ?>