title: Curl + proxy - reload the script if proxy address is unavailable
body: <p>I have a question - I'm using CURL and PROXY. I'm getting list with proxy addresses from paid web service. The list looks like this (example):</p>
  
  <pre><code>123.456.789.012:1234
  123.456.789.012:1234
  123.456.789.012:1234
  123.456.789.012:1234
  123.456.789.012:1234
  123.456.789.012:1234
  123.456.789.012:1234
  </code></pre>
  
  <p>Let's say, that the list mentioned above is available here: <a href="http://example.com/list_with_the_proxy" rel="nofollow">http://example.com/list_with_the_proxy</a></p>
  
  <p>My PHP code looks like this:</p>
  
  <pre><code>&lt;?php
  $url = 'http://connect.to.another.example.net/'; //I want to open this url using one of the proxy address from the list
  
  $proxy_url = 'http://address.of.proxy.example.org';
  
  function RandomLine($filename) { 
      $lines = file($filename) ; 
      return $lines[array_rand($lines)] ; 
  } 
  
  $random_proxy = RandomLine($proxy_url); 
  
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_URL, $url); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); 
  curl_setopt($ch, CURLOPT_PROXY, $random_proxy); 
  $data = curl_exec($ch); 
  curl_close($ch); 
  echo $data;
  
  ?&gt;
  </code></pre>
  
  <p>I have noticed some problem - sometimes some proxy is unavailable, and the site is loading &amp; loading &amp; loading ... Is there any possibility, to reload the script and get new random proxy, if the site is loading too long ? For example if proxy is not responding in 5 seconds, script will load again ?</p>