- var_dump: documentation ( source)
- gethostbyname: documentation ( source)
- getmxrr: documentation ( source)
- checkdnsrr: documentation ( source)
<?php
$domain = 'non-existant-domain-name.com';
if (gethostbyname($domain) == $domain) {
var_dump(checkdnsrr($domain));
var_dump(getmxrr($domain, $mxhosts));
var_dump($mxhosts);
} else {
echo 'Domain exists';
}