$keyword = stackoverflow;
foreach(array(co,net,org,info,us,ca,biz,me,mobi,tv,ws,asia,cc,la,xxx) as $tld )
if (checkdnsrr($keyword.'.'.$tld, 'A')){
echo 'taken
';
}else{
echo 'available
';
}
$tlds = array(co,net,org,info,us,ca,biz,me,mobi,tv,ws,asia,cc,la,xxx);
$numberOFtlds = count($tlds);
$tldResults = array();
function doesDomainExists($keyword,$tld){
if (checkdnsrr($keyword.'.'.$tld, 'A')){
//echo 'taken
';
$tldResults[$tld] = taken;
}else{
$tldResults[$tld] = available;
}
}
// where the function is to be run asynchronously
$finished = false;
while ( ! $finished ):
$number_of_results = count($tldResults);
if ( $tldResults == $numberOFtlds ):
$finished = true;
endif;
endwhile;
function getSession(){
$now = new DateTime(null, new DateTimeZone('America/New_York'));
$i = $now->format('Y-m-d H:i:s');
return md5($i);
}
function countlines($lookupID){
$lines = file('factory/'.$lookupID.'/results.txt');
return count($lines);
}
function startScript($keyword,$tld){
fopen('factory/$lookupID/'.$tld.'.php?keyword='.$keyword.'&tld='.$tld, 'a+');
}
// get keyword
$keyword = 'stackoverflow';
// set array of tlds
$tlds = array(co,net,org,info,us,ca,biz,me,mobi,tv,ws,asia,cc,la,xxx);
// get loop up id
$lookupID = getSession();
// create temporary factory room
mkdir('factory/'.$lookupID, 0777, true);
// fill factory room with scripts
$toolScript = (' ignore_user_abort(true); $k = $_GET["keyword"]; $t = $_GET["tld"]; function tofile($content) { file_put_contents("results.txt", $content."n", FILE_APPEND | LOCK_EX); } if (checkdnsrr("$k.$t", "A")){ tofile("$t|taken"); }else{ tofile("$t|available"); } ?>');
foreach($tlds as $tool) file_put_contents('factory/'.$lookupID.'/'.$tool.'.php', $toolScript);
// initiate while server
file_put_contents('factory/'.$lookupID.'/results.txt', '');
$number_of_tlds = count($tlds);
$finished = false;
while (!$finished):
if (countlines($lookupID) == $number_of_tlds):
$finished = true;
echo done;
endif;
endwhile;
// where the function is to be run asynchronously
foreach ($tlds as $tld) {
startScript($keyword,$tld);
}