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] Link to comment https://forums.phpfreaks.com/topic/23784-undefined-offset-and-fsockopen-errors/ 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] Link to comment https://forums.phpfreaks.com/topic/23784-undefined-offset-and-fsockopen-errors/#findComment-108047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.