开发者

Without using PECL or system() type functions, is there a way to look up DNS records using PHP?

I'm working on creating a new type of email protocol, and in order to do that I had to s开发者_Go百科et up an SRV DNS record for my domain.

In promoting this protocol, I'll need to be able to discover if a given host uses my system (and if not fall back to an older protocol).

So, is there a way to pull a DNS record (such as SRV) using PHP without using a PECL extension or running it through the linux command line (I already know I can ob_start() and system("host -t SRV hostname") but I'm looking for a better way, if it exists.)


Use dns_get_record

array dns_get_record  (  string $hostname  [,  int $type = DNS_ANY  [,  array &$authns  [,  array &$addtl  ]]] )

Fetch DNS Resource Records associated with the given hostname.


Have you considered PEAR::Net_DNS?
http://pear.php.net/package/Net_DNS

As far as I can tell it uses socket connections (tcp/udp) and decodes the resolver data itself. The available methods look pretty extensive.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜