title: any way to speed up php function? many curl requests
body: <p>Curl function to check if link is available is repeated about 600 times, and it take about 20 minutes, i remember year ago makes something and it start to make the same in 30 sec</p>
  
  <pre><code>//return the availability of link
  function check($url){
  $agent = 'Mozilla/4.0 (compatible;)';
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url );
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  curl_setopt($ch, CURLOPT_NOBODY, TRUE);
  curl_setopt($ch, CURLOPT_TIMEOUT_MS, 60000);
  curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
  curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 60000);
  curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:11107');
      // set start time
      $mtime = microtime(); 
      $mtime = explode(' ', $mtime); 
      $mtime = $mtime[1] + $mtime[0]; 
      $starttime = $mtime; 
  $page = curl_exec($ch);
  $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  echo curl_error($ch); echo '&lt;br /&gt;';
      // set end time
      $mtime = microtime(); 
      $mtime = explode(" ", $mtime); 
      $mtime = $mtime[1] + $mtime[0]; 
      $endtime = $mtime; 
          $totaltime = ($endtime - $starttime);
  curl_close($ch);
  
  echo "This script executed in " .$totaltime. " seconds. With ".$httpcode." Status.";
  if($httpcode&gt;=100 &amp;&amp; $httpcode&lt;600) return $httpcode; else return 0;
  }
  </code></pre>
  
  <p>and i call this function with</p>
  
  <pre><code>$new_pr   = check($url);
  </code></pre>