Workerman-DNS/test.php

21 lines
392 B
PHP
Raw Normal View History

2022-12-18 16:32:19 +08:00
<?php
#print_r(dns_get_record('icu',DNS_SOA));
$url='al.c919.n3n.com.cn';
while(true){
preg_match("#\.(.*)#i",$url,$match);//获取根域名
$domin = $match[1];
print_r($domin);
$soa=dns_get_record($domin,DNS_SOA);
if(array_key_exists('0',$soa)){
if(array_key_exists('mname',$soa[0])){
print_r($soa[0]);
break;
}else{
$url=$domin;
}
}else{
$url=$domin;
}
}
?>