com has a corresponding DNS record:
$recordexists = checkdnsrr("example.com", "ANY");
if ($recordexists) echo "The domain name has been reserved. Sorry!";
else echo "The domain name is available!";
?>
This returns the following:
The domain name has been reserved. Sorry!
404 CHAPTER 16 ?– NE TWORKING
You can also use this function to verify the existence of a domain of a supplied
mail address:
$email = "ceo@example.com";
$domain = explode("@",$email);
$valid = checkdnsrr($domain[1], "ANY");
if($valid) echo "The domain exists!";
else echo "Cannot locate MX record for $domain[1]!";
?>
This returns the following:
The domain exists!
Keep in mind this isn??™t a request for verification of the existence of an MX record.
Sometimes network administrators employ other configuration methods to allow for
mail resolution without using MX records (because MX records are not mandatory).
To err on the side of caution, just check for the existence of the domain, without
specifically requesting verification of whether an MX record exists.
Further, this doesn??™t verify whether an e-mail address actually exists. The only
definitive way to make this determination is to send that user an e-mail and ask him
to verify the address by clicking a one-time URL. You can learn more about one-time
URLs in Chapter 14.
Retrieving DNS Resource Records
The dns_get_record() function returns an array consisting of various DNS resource
records pertinent to a specific domain.
Pages:
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485