我正在嘗試驗證給定域是否存在 MX 記錄,但沒有任何效果。// prepare the hostname$hostname = 'gmail.com';$hostname = idn_to_ascii($hostname);//php.net/manual/function.checkdnsrr.php#113537$hostname = sprintf('%s.', $hostname);//php.net/manual/function.checkdnsrr.php#119969// perform the checksdns_get_mx($hostname, $dns_get_mx); // a.k.a. getmxrr()$dns_get_record = dns_get_record($hostname, DNS_MX);$checkdnsrr = checkdnsrr($hostname, 'MX');// output the resultvar_dump(array( 'hostname' => $hostname, 'dns_get_mx' => $dns_get_mx, 'dns_get_record' => $dns_get_record, 'checkdnsrr' => $checkdnsrr,));以下是我得到的內(nèi)容(對于 gmail.com 和 分別嘗試):gmail.comWarning: dns_get_record(): A temporary server error occurred. in /var/www/html/example.phparray (size=4) 'hostname' => string 'gmail.com.' (length=10) 'dns_get_mx' => array (size=0) empty 'dns_get_record' => boolean false 'checkdnsrr' => boolean false如果我用 替換,dns_get_record() 返回一個正確的 IP 地址,而檢查數(shù)r() 返回 。MXAtrue日志中沒有任何內(nèi)容(除了上面的警告),谷歌搜索也無濟于事。如何對此進行調(diào)試?斷續(xù)器此問題出現(xiàn)在我的本地虛擬盒環(huán)境(PHP 5.6.39)中;一切實際上都在生產(chǎn)服務(wù)器上工作(PHP 7.3.11)
- 1 回答
- 0 關(guān)注
- 176 瀏覽
添加回答
舉報
0/150
提交
取消