3

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.

Luci
  • 3,034
  • 6
  • 30
  • 36
  • So something like an NSLOOKUP isn't possible? or http://php.net/gethostbyaddr – Mark Baker Dec 06 '13 at 10:58
  • 2
    The domain could exist but the email address itself couldn't.. what's the use of only checking the domain? – Ali Dec 06 '13 at 10:58
  • https://www.google.com/search?q=whois+api&rlz=1C1GGGE_ruUA538UA538&oq=whois+api&aqs=chrome..69i57j0l5.4059j0j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8 – paka Dec 06 '13 at 10:59
  • @AliTrixx, you are right, but at least if i can detect the domain if fake or not, I can avoid much spam users. – Luci Dec 06 '13 at 11:03

1 Answers1

2

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

Community
  • 1
  • 1
Jason W
  • 3,626
  • 2
  • 22
  • 38