Search code examples
phpdnspear

Get all record types with Net_DNS2


I want to retreive all record types for a domain like google.com. I was using PHP's dns_get_record function for this with the following piece of code.

$result = dns_get_record("google.com",DNS_ANY);

This works pretty good. It returns all records with types like A, AAAA, MX and TXT. But the dns_get_record function has no support for custom nameservers. I found that PEAR package Net_DNS2 does support custom nameservers so I installed that and tried to find all record types. But the Net_DNS2_Resolver class does not seem to support a DNS_ANY type. This means that I need to query all types sequentially and that more time and is more difficult to code.

Does the Net_DNS2_Resolver class support a wildcard type? If not, does the query command support an array of types? The documentation says no but maybe it's out of date or something.

How does the PHP function dns_get_record work? Does it do multiple request for all types in the background or is there really a way to request all types at once? If it's the first than I simply need to create my own code for requesting all record types.


Solution

  • DNS_ANY is supported in the latest release of net dns pear package. Check link below - http://pear.php.net/package/Net_DNS2/docs/latest/Net_DNS2/Net_DNS2_RR_ANY.html#methodrrGet