title: cURL login hangs on curl_exec
body: <p>I'm trying to login to a website using cURL. My code works on other websites, but on this one it hangs on curl_exec, Fatal error: Maximum execution time of 30 seconds exceeded.</p>
  
  <p>I know similar questions have been asked and I've look at them all...I've been trying every combination and modification for my script I can think of, with no luck. Any suggestions? </p>
  
  <pre><code>$username = 'myUsername';
  $password = 'myPassword';
  
  $url="https://www.centraldispatch.com/login/"; 
  $cookie="cookie.txt"; 
  
  if (! file_exists($cookie) || ! is_writable($cookie))
  {
      echo 'Cookie file missing or not writable.';
      exit;
  }
  
  
  $postFields = array(
    'Username' =&gt; $username,
    'Password' =&gt; $password,
    'r' =&gt; '' //a hidden field in the form
  );
  
  $postdata = http_build_query($postFields);
  
  $ch = curl_init(); 
  curl_setopt ($ch, CURLOPT_URL, $url); 
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_VERBOSE, 1);   
  curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");  
  curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
  curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); 
  curl_setopt ($ch, CURLOPT_REFERER, $url); 
  
  curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
  curl_setopt ($ch, CURLOPT_POST, 1); 
  $result = curl_exec ($ch); //code hangs here
  
  echo $result;  
  curl_close($ch);
  </code></pre>