title: CURL stop working
body: <p>I wanna search some links about a word from a list. 
  So i am making a script :</p>
  
  <pre><code>//html code here.
  &lt;?
  if (array_key_exists('form_action', $_POST)){
  $pel=$_POST['url'];
  $toplist=file_get_contents($pel);
  $listgrabbing=explode("\r\n",$toplist);
  foreach($listgrabbing as $item)
  {    
  
  $useragent="Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR 2.0.50727)";
  $urlto=$item;
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $urlto);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  curl_setopt($ch, CURLOPT_COOKIEJAR, "COOKIE.txt"); 
  curl_setopt($ch, CURLOPT_COOKIEFILE, "COOKIE.txt"); 
  curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10); 
  $buffer = curl_exec($ch);
  $po = strpos($buffer,"article");
  if ($po===false)
  {
  echo ($item."---Word didn't found!");
  echo "&lt;br&gt;";
  }
  else {
  echo ($item."---Word Found!");
  echo "&lt;br&gt;";
  }
  }
  }
  ?&gt;
  </code></pre>
  
  <p>It is working fine. But sometimes script stop working suddenly. I don't know why. 
  May it goes into a site which is not responding. but for this i used <code>CURLOPT_CONNECTTIMEOUT</code> . But i haven't find what is the wrong in script. </p>
  
  <p><strong>Actually my problem is , script is stop suddenly while running.</strong></p>