note 30692 added to function.checkdnsrr

From: Date: Tue, 25 Mar 2003 23:08:36 +0000
Subject: note 30692 added to function.checkdnsrr
Groups: php.notes 
Request: Send a blank email to php-notes+get-45816@lists.php.net to get a copy of this message
The checkdnsrr function is not implemented on the Windows platform. The way to get around this problem is to write your own version of checkdnsrr. Example: myCheckDNSRR function myCheckDNSRR($hostName, $recType = '') { if(!empty($hostName)) { if( $recType == '' ) $recType = "MX"; exec("nslookup -type=$recType $hostName", $result); // check each line to find the one that starts with the host // name. If it exists then the function succeeded. foreach ($result as $line) { if(eregi("^$hostName",$line)) { return true; } } // otherwise there was no mail handler for the domain return false; } return false; Note that the type parameter is optional, and if you don't supply it then the type defaults to "MX" (which means Mail Exchange). If any records are found, the function returns TRUE. Otherwise, it returns FALSE. -- http://www.php.net/manual/en/function.checkdnsrr.php http://master.php.net/manage/user-notes.php?action=edit+30692 http://master.php.net/manage/user-notes.php?action=delete+30692 http://master.php.net/manage/user-notes.php?action=reject+30692

« previous php.notes (#45816) next »