0

I'm using the following script to get the contents from multiple urls, but without any modifications it will run forever: https://raw.github.com/jmathai/php-multi-curl/master/EpiCurl.php

I'm trying to get the contents of multiple urls, parallel. It's intended to always get an result.

Question: why is this script running forever and not terminating after some time as expected?

Simon
  • 5,464
  • 6
  • 49
  • 85

1 Answers1

0

You should add code below. It adds a timeout to the connection after a fixed time.

curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
Freak
  • 6,786
  • 5
  • 36
  • 54
Hiren Soni
  • 574
  • 3
  • 11