function DoCommand($c,&$r) { if ($this->fp) { fputs($this->fp,"$c\r"); $this->Sleep(); $this->GetResponse($r); $bad_char = "/\r/"; $r=preg_replace("$bad_char","
",$r); $r_array=explode("\n",$r); $new_r=array(); foreach($r_array as $line) { $to_push=ereg_replace("[^a-zA-Z0-9_.@<>() ]", "", $line); array_push($new_r, $to_push); } $r=implode("", $new_r); } return $r; } function GetResponse(&$r) { $r=''; do { $r.=fread($this->fp,1000); $s=socket_get_status($this->fp); } while ($s['unread_bytes']); }