How to check if a domain name is a CNAME in PHP

前端 未结 3 809
耶瑟儿~
耶瑟儿~ 2021-02-10 04:21

How do I check if the URL accessing the page is the original URL or if it\'s a CNAME record.

For example, I have a site domain.com. Users can setup a CNAME

3条回答
  •  失恋的感觉
    2021-02-10 04:49

    You can use PHPDNS class library to find out what kind of DNS record is a given url.

    $answer->results[x]->typeid //Textual record type ID (A, MX, CNAME etc)
    

提交回复
热议问题