从phpmanual,getmxrr(获取mx记录)是一个bool值,如果记录存在则为true。
但是,我想获得有关邮件域的更多信息,例如:
简单的mx查找记录(hotmail)是这样的:
Pref Hostname IP Address TTL
5 mx1.hotmail.com 65.55.92.152 60 min
5 mx2.hotmail.com 65.55.92.152 60 min
5 mx3.hotmail.com 65.54.188.110 60 min
5 mx4.hotmail.com 65.55.92.136 60 min
我可以使用getmxrr获取上述信息吗?
谢谢。
答案 0 :(得分:5)
第二个参数给出了mx主机列表:
$hosts = array();
getmxrr('hotmail.com', $hosts);
var_dump($hosts);
获取并使用gethostbyname
来获取ip的简单请求 foreach($hosts as $host) {
echo $host . ' ' . gethostbyname($host) . '<br />';
}