简体   繁体   English

如何使用dns_get_record()搜索多个域名扩展

[英]how to search multiple domain extensions using dns_get_record()

I am trying to verify multiple domain names or extensions using dns_get_record() . 我正在尝试使用dns_get_record()验证多个域名或扩展名。

what I have tried to achieve is this. 我试图实现的是这个。

this will only check for single domain or extension. 这只会检查单个域或扩展名。

$name_domain = trim($_POST['domain_name']).$_POST['suffix'];
$response = @dns_get_record($name_domain, DNS_ALL);
if(empty($response)){
            $msg = "<h2 style='color:green;' >Domain $name_domain is available.</h2>";
}else if(!empty($response)){
            $msg = "<h2 style='color:red;'>Domain $name_domain has taken.</h2>";
}
echo $msg;

and this is I tried to check for multiple domain names if they are available or not. 这是我尝试检查多个域名是否可用。

I also want to show that domain names to echo if they are available like parwest.com, parwest.org, parwest.net if this all are available it should be echo as I tried to do. 我还想表明,如果有可用的域名,例如parwest.com,parwest.org,parwest.net,它们可以相互呼应(如果我可以尝试的话)。

else if these are not available or any of from this is not available then that also echo as I showed. 否则,如果这些都不可用或其中的任何一个都不可用,那么这也会像我展示的那样回显。

$name_domain = trim($_POST['domain_name']).$_POST['suffix'];
$domains = array( trim($_POST['domain_name']).'.com', trim($_POST['domain_name']).'.net' ,trim($_POST['domain_name']).'.org',);

$response = @dns_get_record(implode(' ',$domains), DNS_ALL);
if(empty($response)){
            $msg = "<h2 style='color:green;' >Domain ".implode('<br>', $domains)." is available.</h2>";
}else if(!empty($response)){
            $msg = "<h2 style='color:red;'>Domain ".implode('<br>', $domains)." has taken.</h2>";
}

but its not working. 但它不起作用。 :( :(

any idea how can I do this? 知道我该怎么做吗?

$name_domain = trim($_POST['domain_name']).$_POST['suffix'];
$domains = array( trim($_POST['domain_name']).'.com', trim($_POST['domain_name']).'.net' ,trim($_POST['domain_name']).'.org',);

$msg='';
foreach($domains as $d){

$response = @dns_get_record($d, DNS_ALL);
if(empty($response)){
            $msg .= "<h2 style='color:green;' >Domain $d is available.</h2>";
}else if(!empty($response)){
            $msg .= "<h2 style='color:red;'>Domain $d has taken.</h2>";
}

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM