PHP - Fonction getmxrr

Syntaxe

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

Définition et utilisation

Il est utilisé pour obtenir les enregistrements MX vers l'hôte

Valeurs de retour

Il renverra Vrai si enregistrement trouvé ou bien il donnera Faux

Exemple

Essayez l'exemple suivant

<?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/>';
   }
?>

L'exemple ci-dessus donne le résultat comme suit

ASPMX.L.GOOGLE.com
ALT2.ASPMX.L.GOOGLE.com
ALT1.ASPMX.L.GOOGLE.com
ALT4.ASPMX.L.GOOGLE.com
ALT3.ASPMX.L.GOOGLE.com