1

I have a network system that checks other sites and displays results. However some of those sites can be slow to respond.

I'd like Curl to wait only a small time before saying "forget this site!" and moving onto the next.

How do you make curl abort an attempt after so much "idle" time?

The reason I did not post any code is because I have no idea where to even start on this feature! Be kind. :D

Orangeman555
  • 1,179
  • 2
  • 21
  • 45

2 Answers2

3

You have two separate options for the timeout:

CURLOPT_CONNECTTIMEOUT
Time (in seconds) spent connecting (set to 0 for infinite wait time)

CURLOPT_TIMEOUT
Time (in seconds) spent while curl is executing (set to 0 for inifinite wait time)
Samuel Cook
  • 16,620
  • 7
  • 50
  • 62
1

Look into CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT in the manual. Also, search Stack Overflow before posting - Setting Curl's Timeout in PHP

Community
  • 1
  • 1
dudewad
  • 13,215
  • 6
  • 37
  • 46
  • Half the problem is not knowing the terminology to search for. I searched "abort" and such..."timeout" would have brought me right there but I didn't think of such terminology. **In short I DID just that.** – Orangeman555 May 21 '13 at 20:18