vendredi 8 juillet 2016

Difference between checking MX and FILTER_VALIDATE_IP to validate domain

these two PHP scripts validate a website domain and I just want to know what the difference is between the two. Do they both do the same thing? Is one better to use than the other?

This is the first one:

if(!filter_var(gethostbyname($website), FILTER_VALIDATE_IP))
{
//returns false
}

And this is the second one:

if (!checkdnsrr($website,"MX")) {
//returns false
}

They both seem to do the exact same thing.

Aucun commentaire:

Enregistrer un commentaire