chat.php: run(); ?> client.cls.php: ip = $ip; $this->port = $port; $this->socket = ''; $this->version = '1.0.0'; $this->crlf = "\r\n"; set_time_limit(0); @ob_end_clean(); } function create_socket(){ $this->connection = fsockopen($this->ip, $this->port); if(!$this->connection){ $this->logit('ERROR STARTING SOCKET'); die(); } } function set_input($input){ $this->myconn['input'] = $input; return true; } function get_input(){ return $this->myconn['input']; } function reset_input(){ $this->myconn['input'] = ''; return true; } function read_socket(){ return trim(fgets($this->connection),4096); } function socket_end(){ return fclose($this->connection); } function send($msg){ return fwrite($this->connection, $msg); } function logit($msg){ echo '['.date('m/d/Y H:i:s').'] '.$msg."\n"; } function run(){ $this->create_socket(); $this->logit('Itrebal Creations PHP Client Running on Port '.$this->port); $this->send('#nick itrebal2'); while(!feof($this->connection)){ $input = $this->read_socket(); $this->logit('<- '.$input); $this->set_input($input); echo 'LOOPED'; } } } ?>