If you experience dns_get_record not working in production / dns_get_record displaying the warning: "PHP Warning: dns_get_record(): A temporary server error occurred." this guide is for you.
The reason this function may not work in production is that the DNS servers used in production are hardened and dont respond to a `DNS_ANY` query. (This is to stop spam)
To resolve this add the record you wish to receive for example if you want all A and CNAME records: `dns_get_record("www.example.com", DNS_A + DNS_CNAME)`
You can test the output on cli with
php -r '$a = dns_get_record("www.example.com", DNS_A + DNS_CNAME); echo json_encode($a).PHP_EOL; echo "done".PHP_EOL;'
A full list of the record types available can be found here: https://www.php.net/manual/en/function.dns-get-record.php#type