I have been looking for a good email verification script and I seem to find the same one coming up all over the place. I like everything i read about it. I have implemented it but there is one glitch i cannot figure out. It uses fsockopen to verify a domain name and when the domain does not exist it displays the traditional PHP warnings at the top of the screen instead of being caught like (i think) it is supposed to be. When the domain is good, no errors occur. here are the warnings. (code below)
"Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/vcsvaul9/public_html/clients/changeemail.php on line 27
Warning: fsockopen() [function.fsockopen]: unable to connect to vcsvault.co:25 (Unknown error) in /home/vcsvaul9/public_html/clients/changeemail.php on line 27"
Here is the code I am using for verification. Line 27 is the fsockopen line.:
function checkEmail($email)
{
if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email))
{
return FALSE;
}
list($Username, $Domain) = split("@",$email);
if(getmxrr($Domain, $MXHost))
{
return TRUE;
}
else
{
if(fsockopen($Domain, 25, $errno, $errstr, 30)) //LINE 27!!!
{
return TRUE;
}
else
{
return FALSE;
}
}
}
Thanks!!
Daiv