grenouille Posted October 12, 2006 Share Posted October 12, 2006 hi,i found a php-function on the internet to validate an email address, but i'm getting some errors.see the code and the errors below.anyone any idea with might be going wrong? the function seems to work, but it produces errors in some way.thnx in advance,grenouille[quote]Notice: Undefined offset: 1 in ... on line 12Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in ... on line 20Warning: fsockopen(): unable to connect to :25 ... on line 20[/quote][code]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)) { return TRUE; } else { return FALSE; } }}[/code] Quote Link to comment Share on other sites More sharing options...
grenouille Posted October 12, 2006 Author Share Posted October 12, 2006 i found a solution myself. i thought i should post it. it is not actually a solution. i just put an @ before the list and fsockopen functions so the errors are no longer shown.[code]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)) { return TRUE; } else { return FALSE; } }}[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.