簡體   English   中英

傳輸大文件時防止Curl超時

[英]Preventing Curl From Timing Out when transferring a large file

我的PHP Curl Opts有25秒的超時。 如果超過那我得到錯誤:

Operation timed out after 25000 milliseconds with 0 bytes received

有時,盡管我收到一個錯誤,使它在下載文件時似乎超時了。

Operation timed out after 25000 milliseconds with 196879 bytes received

如果下載數據,是否可以使Curl延長超時時間? 還是我讀錯了數據,自從接收到最后一個數據以來已經等待了25秒?

設置如下:

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,3); 
curl_setopt($ch, CURLOPT_TIMEOUT, 25); 

謝謝

將curl超時設置為0,以避免一起超時

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,0); 
curl_setopt($ch, CURLOPT_TIMEOUT,0);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM