Popolitus
Popolitus

Reputation: 463

Check if domain have record CNAME and point to my server

I need to check if my users have add correctly the CNAME record but with this code I get empty array

<?php

$domain="martinashop.club";
if(checkdnsrr($domain,"CNAME")) {
  echo "Passed";
} else {
  echo "Failed";
}
echo "<br>";

print_r(dns_get_record($domain,DNS_CNAME));
echo "<br>";
print_r(dns_check_record($domain,"CNAME"));
?>

I not understan why not get the RECORD my domain using Clouflare maybe this get a error?

Thank you

Upvotes: 0

Views: 603

Answers (1)

Justin
Justin

Reputation: 75

You can't have a CNAME on a naked domain.

CNAMEs can only exist as single records and not combined with any other resource records. Since a domain always has a SOA and NS record, you cannot use a CNAME for the domain. This is specified in RFC 1034, section 3.6.2.

Upvotes: 1

Related Questions