How to check DNS validation in PHP

1 Answer

0 votes
$hostname = "www.seek4info.com";

if (!isset($hostname)) 
   die("\$hostname variable is not set");
                           
if (empty($hostname))
   die("\$hostname variable is empty");

echo $hostname . " - ";
                           
if (checkdnsrr($hostname)) 
    echo "has a valid MX record";
else
    die("is not exist");

 
/*
run:

www.seek4info.com - has a valid MX record

*/

 



answered Oct 8, 2016 by avibootz

Related questions

1 answer 145 views
145 views asked Feb 22, 2019 by avibootz
1 answer 309 views
1 answer 155 views
1 answer 178 views
1 answer 139 views
1 answer 239 views
...