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 232 views
232 views asked Feb 22, 2019 by avibootz
1 answer 386 views
1 answer 225 views
1 answer 291 views
1 answer 245 views
1 answer 355 views
...