PHP: Default cURL timeout value

前端 未结 3 633
死守一世寂寞
死守一世寂寞 2020-12-13 12:24

What is the default PHP cURL timeout value? Can I obtain the value from coding?

3条回答
  •  庸人自扰
    2020-12-13 12:35

    The defaults are as follows:

    • CURLOPT_FTP_RESPONSE_TIMEOUT: Indefinite
    • CURLOPT_TIMEOUT: Indefinite
    • CURLOPT_TIMEOUT_MS: Indefinite
    • CURLOPT_CONNECTTIMEOUT: 300 seconds
    • CURLOPT_CONNECTTIMEOUT_MS: Indefinite
    • CURLOPT_ACCEPTTIMEOUT_MS: 60 seconds

    Previous answer (for reference):

    My understanding is that CURL obeys the default_socket_timeout unless overriden with CURLOPT_TIMEOUT/CURLOPT_CONNECTTIMEOUT.

    $socket_timeout = ini_get('default_socket_timeout'); // timeout in seconds
    

提交回复
热议问题