Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php dns记录_Php_Dns - Fatal编程技术网

php dns记录

php dns记录,php,dns,Php,Dns,当我在php脚本中使用dns_get_record来获取域的dns记录列表时,会返回一个记录列表 但是,如果我再次运行脚本,它不会返回所有相同的结果(即它只返回名称服务器),然后如果我再次运行它,它就会工作,等等 这是我正在使用的代码: $result = dns_get_record("php.net"); print_r($result); 是否有更好的功能或更可靠的方式查询DNS记录 不工作: 数组([0]=>Array([host]=>php.net[type]=>NS[target]

当我在php脚本中使用dns_get_record来获取域的dns记录列表时,会返回一个记录列表

但是,如果我再次运行脚本,它不会返回所有相同的结果(即它只返回名称服务器),然后如果我再次运行它,它就会工作,等等

这是我正在使用的代码:

$result = dns_get_record("php.net");
print_r($result);
是否有更好的功能或更可靠的方式查询DNS记录

不工作:

数组([0]=>Array([host]=>php.net[type]=>NS[target]=>remote2.easydns.com[class]=>IN[ttl]=>38772[1]=>Array([host]=>php.net[type]=>NS[target]=>ns1.easydns.com[class]=>IN[ttl]=>38772][2]=>Array([host]=>php.net[type]=>NS[target]=>NS[class]=>NS[class]=>[host]=>php.net[type]=>NS[target]=>remote1.easydns.com[class]=>IN[ttl]=>38772))

工作:


数组([0]=>Array([host]=>php.net[type]=>MX[pri]=>5[target]=>ose1.php.net[class]=>IN[ttl]=>72984][1]=>Array([host]=>php.net[type]=>MX[pri]=>15[target]=>smtp.ososol.org[class]=>IN[ttl]=>72984][2]=>Array([host]=>php.net[type]=>NS[target]=>php.net[type]=>2.easydns.com[class]=>[3]=>Array([host]=>php.net[type]=>NS[target]=>ns1.easydns.com[class]=>IN[ttl]=>30054[4]=>Array([host]=>php.net[type]=>NS[target]=>ns2.easydns.com[class]=>IN[ttl]=>30054[5]=>Array([host]=>php.net[type]=>NS[target]=>remote1.easydns.com[class]=>IN[ttl]=>30054])

将DNS\u ALL添加到函数调用中应该可以工作

$result = dns_get_record("php.net",DNS_ALL);
print_r($result);
以确保您正在收集所有不同的记录