CURLOPT in PHPcURL

Source: Internet
Author: User
Today I have studied the differences between CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT ), this parameter is used to cope with the overload, deprecation, or crash of the target server. CURLO

Today I have studied the differences between CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT ), this parameter is used to cope with the overload, deprecation, or crash of the target server. CURLO

We have studied the differences between CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT:


CURLOPT_CONNECTTIMEOUT is used to tell the PHP script how long it will wait before successfully connecting to the server (the buffer output will start after the connection is successful). This parameter is used to cope with the overload and deprecation of the target server, or crash;


CURLOPT_TIMEOUT is used to tell the successful PHP script how long it will wait before the server receives the buffer. This parameter is useful if the target file is a huge file and the content generation speed is too slow or the link speed is too slow.


Downloading MP3 files using cURL is a good example for developers. CURLOPT_CONNECTTIMEOUT can be set to 10 seconds. If the server does not respond within 10 seconds, the script will be disconnected. CURLOPT_TIMEOUT can be set to 100. If the MP3 file is not downloaded within 100 seconds, the script will be disconnected.


Original article: http://www.quora.com/Whats-the-difference-between-CURLOPT_CONNECTTIMEOUT-and-CURLOPT_TIMEOUT

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.