title: Php download facebook images with fopen
body: <p>I'm trying to run this code on my VPS</p>
  
  <pre><code>    &lt;?php 
      function curl_get_contents($url, array $opts = array()) {
      $defaults = array(
          CURLOPT_FOLLOWLOCATION =&gt; true,
          CURLOPT_RETURNTRANSFER =&gt; true,
          CURLOPT_USERAGENT =&gt; 'Mozilla Firefox 20.0',
          CURLOPT_VERBOSE =&gt; true
      );
      $opts = $opts + $defaults;
      $ch = curl_init($url);
      curl_setopt_array($ch, $opts);
  
      return curl_exec($ch);
  }
  
  header('Content-type: image/jpeg');
  echo curl_get_contents('http://sphotos-b.ak.fbcdn.net/hphotos-ak-prn1/58678_10151328142003680_1939974573_n.jpg');
  
  ?&gt; 
  </code></pre>
  
  <p>when i run it, there's a infinite loop and i don't understand why. the function works with every image url, but not with facebook. Any Suggestion?</p>