Reputation: 3264
If anyone knows how can we detect fake domain names of email addresses, it would be a great help.
Note, that I don't want to validate an email. I want to know if the email domain name exists or not.
Upvotes: 3
Views: 1452
Reputation: 3682
in php there is a function checkdnsrr
How do you check if a domain name exists?
if (checkdnsrr('test.nl', 'A')) // or use ANY or for other see above link
{
echo 'Domain exists';
}
else
{
echo 'Domain does not exist';
}
------------------ Code that is working -------
<?php
if (checkdnsrr('google.com', 'A')) // or use ANY or for other see above link
{
echo 'Domain exists';
}
else
{
echo 'Domain does not exist';
}
?>
//Output = Domain exists
//
if (checkdnsrr('fakewebtesting.com', 'A')) // or use ANY or for other see above link
{
echo 'Domain exists';
}
else
{
echo 'Domain does not exist';
}
?>
//Output = Domain does not exists
I hope you are extracting domain name from email and using it in this function.
Docs link:
http://php.net/manual/en/function.checkdnsrr.php
Upvotes: 2