【发布时间】:2015-07-01 11:33:50
【问题描述】:
我正在尝试使用 cURL 从服务器 1 访问服务器 2 上的 API。 从服务器 2 返回数据从开始到结束大约需要 15 秒。 API 接受 GET 信息,在地址栏中输入 URL 和参数会立即返回数据。所以我很高兴 API 代码是高性能的,问题在于 cURL 请求/网络沿线某处。
使用 curl_getinfo() 方法我看到以下内容:
[url] => http://[targetURL]
[content_type] => application/json
[http_code] => 200
[header_size] => 423
[request_size] => 135
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 15.137161
[namelookup_time] => 15.039278
[connect_time] => 15.057024
[pretransfer_time] => 15.057177
[size_upload] => 0
[size_download] => 849
[speed_download] => 56
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => 0
[starttransfer_time] => 15.131828
[redirect_time] => 0
[certinfo] => Array
(
)
[primary_ip] => xxxx
[primary_port] => 80
[local_ip] => yyyy
[local_port] => 24995
[redirect_url] =>
困扰我的是namelookup_time。 这是尝试使用 DNS 解析我指定的域吗? 是否可以指定IP地址? 如果是这样,我的主机会为我的包分配一个 IP。有没有人有为子域分配端口号或专用 IP 的经验? 我的主机是1&1,包是Unlimited Plus。
非常感谢您的任何智慧之言。 标记
【问题讨论】: