How does the function checkdnsrr behave on Windows platforms according to the PHP manual?
The function checkdnsrr behaves differently on Windows platforms compared to Unix-like systems. On Windows, the function only checks if a record of the specified type exists for the given hostname, without actually performing a DNS query. To work around this limitation, you can use the dns_get_record function instead, which works consistently across different platforms.
function check_dns_record($host, $type) {
$records = dns_get_record($host, $type);
return !empty($records);
}
// Example usage
$host = 'example.com';
$type = 'A';
if (check_dns_record($host, $type)) {
echo "DNS record found for $host";
} else {
echo "No DNS record found for $host";
}