possible_tlds = array_keys($servers); // this is the array from the included server list $i = 0; $available = 0; $total = 0; $skipped = 0; $sleep = 0; $tld = 'com'; $ltrs = array('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z'); srand((float) microtime() * 10000000); $done = array(); // 17576 // do query while($i < 50) { // sleep for 5s, in steps of 100 if ($i % 10 == 0 && $i > 9) { $sleep++; sleep(3); } // whois config $my_whois->tld = 'com'; $domain = $my_whois->domain = array_rand($ltrs, 1) . array_rand($ltrs, 1) . array_rand($ltrs, 1); // dont bother querying the same domain twice if (!in_array($domain, $done)) { $done[$i] = $domain; $my_whois->free_string = $servers[$tld]['free']; $my_whois->whois_server = $servers[$tld]['address']; $my_whois->whois_param = $servers[$tld]['param']; $my_whois->process(); //echo $i. $my_whois->msg . "\n"; $domaininfo = $i . $my_whois->msg . "\n"; file_put_contents("results_com_3.txt", $domaininfo, FILE_APPEND); unset($domaininfo); $i++; $total++; } else { $skipped++; } } // calculate execution time $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); // calculate execution time $contents .= "------------------------------------------------------------------------\n"; $contents .= $total." domains looked up, ". $available . " are available, " . $skipped . " were skipped, slept " . $sleep . " times. Total execution time: " . $totaltime . " seconds."; file_put_contents("results_com_3.txt", $contents, FILE_APPEND); ?>