我遇到来自实时服务器的cURL请求问题。我已经看到了url,但没有得到解决方案。
尝试请求本地URL而不是562ms。
但相同的代码需要1.1分钟的实时网址。
以下是curl_getinfo($cSession)
详细信息:
Array
(
[url] => http://***.***.**.**
[content_type] =>
[http_code] => 0
[header_size] => 0
[request_size] => 0
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 62.261039
[namelookup_time] => 0.000148
[connect_time] => 0
[pretransfer_time] => 0
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0
[redirect_time] => 0
[certinfo] => Array
(
)
[primary_ip] =>
[primary_port] => 0
[local_ip] =>
[local_port] => 0
[redirect_url] =>
)
下面我正在使用代码:
$cSession = curl_init();
//step2
curl_setopt($cSession, CURLOPT_URL,"$url");
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_ENCODING, 'gzip');
//step3
$result=curl_exec($cSession);
$cinfo = curl_getinfo($cSession);
//step4
curl_close($cSession);
//step5, result of curl
// echo $result;
print_r($cinfo);
任何人都可以帮助我,我失败了。
答案 0 :(得分:0)
而不是
curl_setopt($cSession, CURLOPT_ENCODING, 'gzip');
尝试使用
curl_setopt($cSession, CURLOPT_ENCODING, '');