note 64351 added to function.getmxrr
| From: | php-general at lists dot php dot net | Date: | Wed, 12 Apr 2006 19:32:12 +0000 |
| Subject: | note 64351 added to function.getmxrr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107917@lists.php.net to get a copy of this message | ||
Below Code Used and edited from -ng4rrjanbiah at rediffmail dot com- posted note.
Testing on Windows 2000 Advanced Server.
PHP v4.4.1
function getmxrr($hostname, &$mxhosts)
{
$mxhosts = array();
exec('%SYSTEMDIRECTORY%\\nslookup.exe -q=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..
getmxrr('yahoo.com', $mxhosts);
print_r($mxhosts);
As you can see the only thing i had to do in order to make this work was add a direct path to
nslookup and add the .exe extension. You can use either the "Type" or "Q"
parameter, both worked for me. I am not sure as to why the inital script failed... Safe Mode is on,
but that is not the culprit. If i look into it and find an answer i will post it. My initial
thoughts are that the SystmDir and WinDir Environment Vars are set to C:\WINNT when i would think
SystemDir is actually supposed to be C:\WINNT\System32 for windows systems... but i also think that
because C:\WINNT\System32 is in my Windows OS Environmental Var PATH that it shouldn't matter
so i am not sure why i had to put in the whole path, but either way it now works. If anyone has some
insight or simply wants to point me to something i can read, that'd be much appreciated as i
will probably not think about this issue again... Especially since this particular system has had
way too many changes to it and programs installed etc... it is an all around test unit. The issue
may be mine alone, but i thought i would post this in hopes of saving someone time just in case.
----
Server IP: 64.71.164.2
Probable Submitter: 69.48.33.98
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.getmxrr.php
Edit -- http://master.php.net/note/edit/64351
Del: integrated -- http://master.php.net/note/delete/64351/integrated
Del: useless -- http://master.php.net/note/delete/64351/useless
Del: bad code -- http://master.php.net/note/delete/64351/bad+code
Del: spam -- http://master.php.net/note/delete/64351/spam
Del: non-english -- http://master.php.net/note/delete/64351/non-english
Del: in docs -- http://master.php.net/note/delete/64351/in+docs
Del: other reasons-- http://master.php.net/note/delete/64351
Reject -- http://master.php.net/note/reject/64351
Search -- http://master.php.net/manage/user-notes.php