• PHP Video Tutorials

PHP - Function getmxrr



Syntax

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

Definition and Usage

It is used to get the MX records to Host

Return Values

It will return True if record found or else it will give false

Example

Try out following example

<?php
   getmxrr("tutorialspoint.com", $mx_records, $mx_weight);
   for($i = 0;$i<count($mx_records);$i++){
      $mxs[$mx_records[$i]] = $mx_weight[$i];
   }
   asort ($mxs);
   $records = array_keys($mxs);
   for($i = 0; $i < count($records); $i++){
      echo $records[$i];
      echo '<br/>';
   }
?>

Above Example gives the result as follows

ASPMX.L.GOOGLE.com
ALT2.ASPMX.L.GOOGLE.com
ALT1.ASPMX.L.GOOGLE.com
ALT4.ASPMX.L.GOOGLE.com
ALT3.ASPMX.L.GOOGLE.com
php_function_reference.htm
Advertisements