Using the dns_get_mx() Function : dns_get_mx « DNS « PHP






Using the dns_get_mx() Function

 
<?php

    $hostname = "google.com";
    if(dns_get_mx($hostname, $mxhosts, $weights)) {

        foreach($mxhosts as $key => $host) {

            echo "Hostname: $host (Weight: {$weights[$key]}<BR/>\n";

        }

    } else {

        echo "Could not find any MX records for $hostname\n";

    }

?>
  
  








Related examples in the same category