I am trying to use two different functions to validate the domain/host names
when I use
checkdnsrr(end($domainname))
I get none or false response.
but when I use
dns_get_record(end($domainname))
I get my domain listed and true response
will checkdnsrr
use different method to resolve hostnames?
The default record type for checkdnsrr()
is "MX"
.
The default type for dns_get_record()
is DNS_ANY
.
If your domain doesn't have an MX record, you'll get an empty response from the first call. The second call will find whatever records are available for the domain.
What you're more likely to be interested in are A
records, which contain the site's IPv4 address. Try
checkdnsrr(end($domainname), "A")
dns_get_record(end(domainname), DNS_A)