title: PHP curl timeout error detection
body: <p>I use curl to perform a HTTP request like this:</p>
  
  <pre><code>$ch = curl_init();
  $timeout = 5;
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
  
  $data = curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>How can I check if an error occurred, and whether it was a timeout error?</p>