note 40236 added to function.getmxrr
| From: | ng4rrjanbiah at rediffmail dot com | Date: | Thu, 26 Feb 2004 08:11:04 +0000 |
| Subject: | note 40236 added to function.getmxrr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65779@lists.php.net to get a copy of this message | ||
Here is a better workaround for Windows platform. Tested on Windows XP. Highly impressed by
"geoffbrisbine A T y a h o o DOT c o m"'s idea of nslookup usage.
<?php
function getmxrr($hostname, &$mxhosts)
{
$mxhosts = array();
exec('nslookup -type=mx '.$hostname, $result_arr);
foreach($result_arr as $line)
{
if (preg_match("/.*mail exchanger = (.*)/", $line, $matches))
$mxhosts[] = $matches[1];
}
return( count($mxhosts) > 0 );
}//--End of workaround
//test..
echo getmxrr('yahoo.com', $mxhosts);
print_r($mxhosts);
?>
HTH,
R. Rajesh Jeba Anbiah
----
Manual Page -- http://www.php.net/manual/en/function.getmxrr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40236
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40236&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40236&report=yes
Search -- http://master.php.net/manage/user-notes.php