note 42396 added to function.getmxrr
| From: | zorlac_man at hotmail dot com | Date: | Fri, 14 May 2004 16:15:34 +0000 |
| Subject: | note 42396 added to function.getmxrr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69616@lists.php.net to get a copy of this message | ||
For some reason this and the other DNS lookup functions seem to be really slow on my Linux box.
I've checked several things and have no explanation.
As a work-around, I gave in and just used a system call to dig:
<?php
CheckMX("fakedomain.org");
CheckMX("hotmail.com");
function CheckMX($domain) {
exec("dig +short MX " . escapeshellarg($domain),$ips);
if($ips[0] == "") {
print "MX record found for $domain not found!\n";
return FALSE;
}
print "MX Record for $domain found\n";
return TRUE;
}
?>
Output:
MX record found for fakedomain.org not found!
MX Record for hotmail.com found
As someone else pointed out, it is prudent to check to see if the TLD has an IP address if the MX
record is not found.
----
Manual Page -- http://www.php.net/manual/en/function.getmxrr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42396
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42396&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42396&report=yes
Search -- http://master.php.net/manage/user-notes.php