How to use getmxrr() function to get max records for host in PHP

1 Answer

0 votes
// bool getmxrr ( string $hostname , array &$mxhosts [, array &$weight ] )

getmxrr("google.com", $mx_records, $mx_weight);
   
echo "<pre>";
print_r($mx_records);
echo "</pre>";

echo "<pre>";
print_r($mx_weight);
echo "</pre>";
    
/*
run: 

Array
(
    [0] => alt1.aspmx.l.google.com
    [1] => alt3.aspmx.l.google.com
    [2] => alt4.aspmx.l.google.com
    [3] => alt2.aspmx.l.google.com
    [4] => aspmx.l.google.com
)

Array
(
    [0] => 20
    [1] => 40
    [2] => 50
    [3] => 30
    [4] => 10
)

*/

 



answered May 8, 2016 by avibootz
...