Jump to content

checkdnsrr() error


mbrown

Recommended Posts

				list($emailusername,$domain)=split('@',$email);
				if(!checkdnsrr($domain, 'MX')) 
				{
					$errorMessage .= "<br />The domain entered, $domain, does not have a valid mail server";
				}

Error Message: Fatal error: Call to undefined function checkdnsrr() in C:\xampp\htdocs\seniorProject\register\validation.php on line 125

 

Server is running off of Windows Vista SP1 x64 with XAMPP

Link to comment
https://forums.phpfreaks.com/topic/144402-checkdnsrr-error/
Share on other sites

It maybe for a linux distro, but versions before 5.3 did not have the right functionality of that function for windows, unfortunately.

 

function win_checkdnsrr($host, $type='MX') {
    if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { return; }
    if (empty($host)) { return; }
    $types=array('A', 'MX', 'NS', 'SOA', 'PTR', 'CNAME', 'AAAA', 'A6', 'SRV', 'NAPTR', 'TXT', 'ANY');
    if (!in_array($type,$types)) {
        user_error("checkdnsrr() Type '$type' not supported", E_USER_WARNING);
        return;
    }
    @exec('nslookup -type='.$type.' '.escapeshellcmd($host), $output);
    foreach($output as $line){
        if (preg_match('/^'.$host.'/',$line)) { return true; }
    }
}

 

There is some code you can use in place of checkdnsrr for Windows.

Link to comment
https://forums.phpfreaks.com/topic/144402-checkdnsrr-error/#findComment-760648
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.