Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abhishek009's avatar

Default timeout for CURL in Laravel

Hi,

I'm currently downloading image from the woocommerce API which uses the CURL. I kept default timeout to forever, still it shows this error.

 [Automattic\WooCommerce\HttpClient\HttpClientException]
  Error: Error getting remote image https://s3.ap-south-1.amazonaws.com/productimages1234/images/elega
  ntayeshav5-01.jpg. Error: cURL error 28: Operation timed out after 9874 milliseconds with 3167876 ou
  t of 3573589 bytes received. [woocommerce_api_invalid_remote_product_image]

My CURL settings:

 \curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
        \curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
        \curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 0);
        \curl_setopt($this->ch, CURLOPT_TIMEOUT, 0);
        \curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
        \curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
        \curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->request->getRawHeaders());
        \curl_setopt($this->ch, CURLOPT_URL, $this->request->getUrl());

Any idea why I'm getting this error ?

Thanks!

0 likes
2 replies
abhishek009's avatar

I also tried set_time_limit(0); But it's also giving the same error !

mfadel's avatar

I have a similiar problem that I am trying to solve, I am trying to post products from web page using curl, I am having this error

(1/1) HttpClientException cURL Error: Operation timed out after 15000 milliseconds with 13630 bytes received in HttpClient.php (line 380),

I am trying to solve it, any clues?

Please or to participate in this conversation.