wdf2006
06 Oct 2006, 01:10 PM
Three months ago I installed an XAMPP on my workstation to host my local test server . It had been working fine until yesterday. Today I found that most of my php files could not be displayed on web browsers (Firefox, Netscape, and IE). The file loading kept going and going with no ending. I could not figure out what caused the problem. As an example, the following php script I ran it successfully just a few days ago, but I could not run it today because of endless page loading on browse. I will much appreciate if you have any ideas and thoughts.
getmxrr_tester.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Function getmxrr() Tester</title>
</head>
<body>
<?php
//----------------------------------------------------------------------------
//Input a domain name (address), then find all email server names (addresses)
//registered on the domain. This is a workaround for function getmxrr() which is
//not supported by MS Windows. To make it work with Windows, you need to use
//this modified getmxrr()
//----------------------------------------------------------------------------
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))
//$matches is a array with two elements, but we are interested in $matches[1] only
$mxhosts[] = $matches[1]; //Get mailserver (mail exchanger) address from $matches[1]
//$mxhosts[] = $matches[0]; //Get domain, preference and mailserver in a string
}
//return array $mxhosts > 0 );
return $mxhosts;
}//--End of workaround
//================
// Test It
//================
getmxrr('isc.ucsb.edu', $mxhosts);
echo 'The total # of mail servers found on ISC.UCSB.EDU ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('aol.com', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on AOL.COM ====> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('hotmail.com', $mxhosts).'<br>' . '<br>';
echo '<br>' . '<br>';
echo 'The total # of mail servers found on HOTMAIL.COM ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('yahoo.com', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on YAHOO.COM ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('bellsouth.net', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on BELLSOUTH.NET ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('verizon.net', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on VERIZON.NET ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('hushmail.com', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on HUSHMAIL.COM ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
?>
</body>
</html>
getmxrr_tester.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Function getmxrr() Tester</title>
</head>
<body>
<?php
//----------------------------------------------------------------------------
//Input a domain name (address), then find all email server names (addresses)
//registered on the domain. This is a workaround for function getmxrr() which is
//not supported by MS Windows. To make it work with Windows, you need to use
//this modified getmxrr()
//----------------------------------------------------------------------------
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))
//$matches is a array with two elements, but we are interested in $matches[1] only
$mxhosts[] = $matches[1]; //Get mailserver (mail exchanger) address from $matches[1]
//$mxhosts[] = $matches[0]; //Get domain, preference and mailserver in a string
}
//return array $mxhosts > 0 );
return $mxhosts;
}//--End of workaround
//================
// Test It
//================
getmxrr('isc.ucsb.edu', $mxhosts);
echo 'The total # of mail servers found on ISC.UCSB.EDU ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('aol.com', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on AOL.COM ====> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('hotmail.com', $mxhosts).'<br>' . '<br>';
echo '<br>' . '<br>';
echo 'The total # of mail servers found on HOTMAIL.COM ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('yahoo.com', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on YAHOO.COM ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('bellsouth.net', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on BELLSOUTH.NET ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('verizon.net', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on VERIZON.NET ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
getmxrr('hushmail.com', $mxhosts);
echo '<br>' . '<br>';
echo 'The total # of mail servers found on HUSHMAIL.COM ==> '.count($mxhosts).'<br>'.'<br>';
echo 'The mail server addresses are: ' . '<br>';
echo '<pre>'; // This is just to make it look nice
print_r($mxhosts);
echo '</pre>';
echo '-------------------------------------------------';
//------------------------------
?>
</body>
</html>