note 74809 added to function.checkdnsrr

From: Date: Sat, 28 Apr 2007 01:05:44 +0000
Subject: note 74809 added to function.checkdnsrr
Groups: php.notes 
Request: Send a blank email to php-notes+get-125938@lists.php.net to get a copy of this message
Here is a modification to the note below: function check_email($email) { if(preg_match('/^\w[-.\w]*@(\w[-._\w]*\.[a-zA-Z]{2,}.*)$/', $email, $matches)) { if(function_exists('checkdnsrr')) { if(checkdnsrr($matches[1] . '.', 'MX')) return true; if(checkdnsrr($matches[1] . '.', 'A')) return true; }else{ if(!empty($hostName)) { if( $recType == '' ) $recType = "MX"; exec("nslookup -type=$recType $hostName", $result); foreach ($result as $line) { if(eregi("^$hostName",$line)) { return true; } } return false; } return false; } } return false; } This makes it compatible with windows and will make sure it actually checks the domain. ---- Server IP: 69.147.83.197 Probable Submitter: 74.129.3.228 ---- Manual Page -- http://www.php.net/manual/en/function.checkdnsrr.php Edit -- https://master.php.net/note/edit/74809 Del: integrated -- https://master.php.net/note/delete/74809/integrated Del: useless -- https://master.php.net/note/delete/74809/useless Del: bad code -- https://master.php.net/note/delete/74809/bad+code Del: spam -- https://master.php.net/note/delete/74809/spam Del: non-english -- https://master.php.net/note/delete/74809/non-english Del: in docs -- https://master.php.net/note/delete/74809/in+docs Del: other reasons-- https://master.php.net/note/delete/74809 Reject -- https://master.php.net/note/reject/74809 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125938) next »