N
N
Nadim Zakirov2021-07-26 11:32:23
PHP
Nadim Zakirov, 2021-07-26 11:32:23

How to properly set request timeout in cURL?

Noticed something interesting. If in cURL I set a timeout equal to 10 seconds using CURLOPT_TIMEOUT , then the request in the browser is interrupted not after 10 seconds, but after 14 - 15 seconds. Where and due to what are these additional 4 - 5 seconds above the timeout taken from? Is there any way to set strictly 10 seconds? Perhaps it makes sense to use not the native timeout from cURL , but an external one through the php-function set_time_limit ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Belyaev, 2021-07-26
@PavelBelyaev

curl_setopt($cl,CURLOPT_TIMEOUT,90);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question