Version: 1.0
Type: Full Script
Category: Other
License: GNU General Public License
Description: Type in characters, words or phrases seperated by commas, and get all permutations as a .com printed out with the statement available or not available.
<? function checkDom ($domName) { set_time_limit(0); $openStr = "http://reports.internic.net/cgi-bin/whois?whois_nic=".$domName.".com&type=domain"; $handle = fopen ($openStr, "r"); while (!feof ($handle)) { $line = fgetss($handle, 4096); if (strstr($line, "Domain Name: ")) { echo $domName.".com is not available.<br>"; break; } else if (strstr($line, "No match for domain")) { echo "<h3>".$domName.".com is available!</h3>"; break; } } fclose ($handle); } function getChar ($arrChars, $intChar) { return $arrChars[$intChar]; } function mkDomStr($arrChars, $intChars, $domStr = "") { $n = count($arrChars); $prDomStr = $domStr; for ($i = 0; $i < $n; $i++) { $prDomStr = $domStr.getChar($arrChars, $i); if ($intChars - 1 > 0) { mkDomStr ($arrChars, $intChars - 1, $prDomStr); } else { checkDom($prDomStr); } } } $charFrom = $_POST[charFrom]; $charTo = $_POST[charTo]; $chars = $_POST[chars]; $submit = $_POST[submit]; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Get Available Domains</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="getdoms.php" method="post"> From <input name="charFrom" type="text" size="5" maxlength="2" value="2"> chars to <input name="charTo" type="text" size="5" maxlength="2" value="3"> chars<br> <input name="chars" type="text" value="a,b,c"><input name="submit" type="submit" value="Get Available"> </form> <? if ($submit == "Get Available") { echo "<h3>Characters : $chars<br>From $charFrom to $charTo characters.</h3>"; $defChars = explode(",", $chars); for ($i = $charFrom; $i <= $charTo; $i++) { mkDomStr($defChars, $i); } } ?> </body> </html>