我在PHP中使用curl调用API,有时它工作正常,有时我得到 Failed to connect to api-domain.com port 80: Connection timed out
这有点奇怪,有时它正在工作,有时它不是.要解决我打印的问题,curl_getinfo()当它不工作时,请在下面查看.
它显示连接时间= 0和总时间= 130秒,我不确定它是什么意思.如果任何人对此有充分了解,请查看以下日志并帮助我了解具体问题.
[url] => http://api-domain.com/?act=get_story_banners
[content_type] => text/html; charset=UTF-8
[http_code] => 200
[header_size] => 630
[req uest_size] => 283
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 130.335916
[namelookup_time] => 0.000016
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 744
[speed_download] => 13814
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 34.231.133.7
[certinfo] => Array()
[primary_port] => 80
[local_ip] => xxx.xxx.xxx.xxx
[local_port] => 48080
预先感谢!
编辑
有时卷曲请求来自REST API服务器,有时它不会.它在连接级别本身被丢弃,不会到达REST API服务器.我有点困惑,为什么有时它连接,有时它不连接.