When using dns_get_record
with DNS_ANY
or DNS_ALL
, it does not work with this warning message.
php -r "var_dump(dns_get_record('google.com', DNS_ANY));"
PHP Warning: dns_get_record(): A temporary server error occurred. in Command line code on line 1
bool(false)
Using DNS_ANY
on dns_get_record
is not recommended on production server.
This is because using DNS_ANY
is considered to be a DNS Amplification Attack.
Some references:
https://www.cisa.gov/uscert/ncas/alerts/TA13-088A
https://blog.cloudflare.com/deprecating-dns-any-meta-query-type/
https://datatracker.ietf.org/doc/html/rfc8482
https://fanf.livejournal.com/140566.html
We recommend you to modify your code a little bit, instead of using this code,
dns_get_record('google.com', DNS_ANY)
You can use this for example
dns_get_record('google.com', DNS_A + DNS_AAAA + DNS_CNAME + DNS_NS + DNS_TXT + DNS_MX )
Now, it should works in your server.