PHP file_get_contents域名超級慢,連接IP卻很快

科技 未結(jié) 5 884

用服務(wù)器ping了下接口服務(wù)器的域名和IP如下,訪問接口時候采用域名的話,服務(wù)器就會超時,每次都超過20秒,然后直接連接失敗,不知道為什么,用IP就不會,怎么解決

一、ping域名
array(9) {

[0]=>
string(59) "PING www.honourt.com (112.74.100.239) 56(84) bytes of data."
[1]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=1 ttl=50 time=45.8 ms"
[2]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=2 ttl=50 time=45.5 ms"
[3]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=3 ttl=50 time=45.9 ms"
[4]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=4 ttl=50 time=46.6 ms"
[5]=>
string(0) ""
[6]=>
string(39) "--- www.honourt.com ping statistics ---"
[7]=>
string(62) "4 packets transmitted, 4 received, 0% packet loss, time 7223ms"
[8]=>
string(52) "rtt min/avg/max/mdev = 45.594/45.999/46.636/0.387 ms"
}

二、ping ip

array(9) {
[0]=>
string(58) "PING 112.74.100.239 (112.74.100.239) 56(84) bytes of data."
[1]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=1 ttl=50 time=45.6 ms"
[2]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=2 ttl=50 time=46.0 ms"
[3]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=3 ttl=50 time=45.6 ms"
[4]=>
string(60) "64 bytes from 112.74.100.239: icmp_seq=4 ttl=50 time=45.9 ms"
[5]=>
string(0) ""
[6]=>
string(38) "--- 112.74.100.239 ping statistics ---"
[7]=>
string(62) "4 packets transmitted, 4 received, 0% packet loss, time 3051ms"
[8]=>
string(52) "rtt min/avg/max/mdev = 45.629/45.814/46.025/0.237 ms"
}

5條回答
提交回復(fù)