I've a PHP function which fetches a Curl request. This request sometimes take longer time than expected and hence my php function takes longer to return.
In my particular case, output of curl request is not important. So is it possible with curl just to place a request and proceed without waiting for curl_exec() to finish?
PHP does not support multi-threading, so this is not possible. You can, however, limit the amount of time cURL will execute.
$max_exe_time = 250; // time in milliseconds
curl_setopt($curl_handle, CURLOPT_TIMEOUT_MS, $max_exe_time);
You can read about this configuration option and others: http://php.net/manual/function.curl-setopt.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With