id_list = file($str_list); } /* Start the scanning process....*/ function start_scan(){ $this->new_connect(); } /* Single socket <3 */ function new_connect(){ /* If end of list, die saying the script has completed. */ if($this->cur_id >= count($this->id_list)) die('Scanning complete.'); /* INC the index up */ $this->cur_id++; /* Set our current ID. */ $this->id = $this->id_list[$this->cur_id]; /* eww */ $bad = array( "\n", "\r", " ", ); $this->id = str_replace($bad, "", $this->id); /* Replace bad strings that PHP sometimes picks up when reading files. */ $socket = fsockopen("mx.briefcase.yahoo.com", 80, $errno, $errstr, 30); /* Open our connection */ if ($socket ){ /* Connection established! */ /* Packet */ $out = "GET /" . $this->id . " HTTP/1.1\r\n"; $out .= "Host: mx.briefcase.yahoo.com\r\n"; $out .= "Connection: Close\r\n\r\n"; /* Send the packet */ fwrite($socket, $out); /* While receiving data, similar to .GetData of VB's Winsock(fgets) */ while( !feof( $socket ) ){ $tmp_ret = fgets($socket, 256); /* If our string is in the return... */ if(preg_match('#' . $this->good_ret . '#', $tmp_ret)){ $this->log_id($this->id); /* Log it! */ } break; /* Exit the while() */ } fclose($socket); /* Close our socket */ $this->new_connect(); /* Connect again! */ } } /* Saving function */ function log_id($strID){ $fh = fopen($this->found_list, 'a'); /* Open for append */ fwrite($fh, $strID. "\r\n"); /* Write it */ fclose($fh); /* Close it */ } } /* Create the class */ $scanner = new idscanner; /* Load a list */ $scanner->load_list('woah.txt'); /* Select a text file to save found items in. */ $scanner->found_list = 'found_' . time() . '.txt'; /* Start scanning. */ $scanner->start_scan(); ?>