查找MX服务器并显示

时间:2018-06-23 17:17:08

标签: php email dns

我正在尝试制作一个脚本,该脚本会在GET中接收“电子邮件”,然后显示MX服务器,我很讨厌这段代码无法正常工作!

<?php
   $email = $_GET['email'];
   list($username,$domain) = split("@",$email);
   echo getmxrr($domain)
?>

1 个答案:

答案 0 :(得分:0)

找到了答案

<?php
//$email = $_GET['email'];
//list($username,$domain) = split("@",$email);
//echo getmxrr($domain)

   $email = $_GET['email'];
   list($username,$domain) = split("@",$email);
   $mxlist = array();
   echo getmxrr($domain,$mxlist);
   foreach($mxlist as $value){
    echo $value . "<br>";
    }
?>