php dns记录 [英] php dns records

查看:132
本文介绍了php dns记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I use dns_get_record within a php script to get a list of DNS records for a domain, a list of records are returned.

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

But then if I run the script again it does not return all of the same results(ie it just returns the name servers) then if I run it again it works etc.

这是代码我正在使用:

$result = dns_get_record("php.net");
print_r($result);

是否有更好的功能使用或更可靠的方式来查询DNS记录?

Is there a better function to use or a more reliable way of querying for DNS records?

NOT WORKING:

NOT WORKING:

Array([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] => ns2.easydns。 com [class] => IN [ttl] => 38772)[3] => Array([host] => php.net [type] => NS [target] => remote1.easydns.com [class] => IN [ttl] => 38772))

Array ( [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] => ns2.easydns.com [class] => IN [ttl] => 38772 ) [3] => Array ( [host] => php.net [type] => NS [target] => remote1.easydns.com [class] => IN [ttl] => 38772 ) )

工作:

Array([0] => Array [host] => php.net [type] => MX [pri] => 5 [target] => osu1.php.net [class] => IN [ttl] => 72984)[1] => [host] => php.net [type] => MX [pri] => 15 [target] => smtp.osuosl.org [class] => IN [ttl] => 72984)[2] => Array [host] => php.net [type] => NS [target] => remote2.easydns.com [class] => IN [ttl] => 30054) [3] => Array([host] => php.net [type] => NS [target] => ns1.easydns.com [class] => IN [ttl] => 30054)[4] => ([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))

Array ( [0] => Array ( [host] => php.net [type] => MX [pri] => 5 [target] => osu1.php.net [class] => IN [ttl] => 72984 ) [1] => Array ( [host] => php.net [type] => MX [pri] => 15 [target] => smtp.osuosl.org [class] => IN [ttl] => 72984 ) [2] => Array ( [host] => php.net [type] => NS [target] => remote2.easydns.com [class] => IN [ttl] => 30054 ) [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_ALL添加到函数调用中应该工作

Adding DNS_ALL to the function call should work

$result = dns_get_record("php.net",DNS_ALL);
print_r($result);

确保您收集所有不同的记录。

To ensure you are collecting all the different records.

这篇关于php dns记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆