title: curl_exec vs curl_multi_getcontent
body: <p>so I'm trying to get the contents of an image (the first 700 bytes of it) from a remote site: </p>
  
  <pre><code>$headers = array(
  "Range: bytes=0-700"
  );
  $curl = curl_init($url);
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  $raw = curl_exec($curl);
  curl_close($curl);
  @$im = imagecreatefromstring($raw);
  </code></pre>
  
  <p>where $url is some remote image....and it works just fine</p>
  
  <p>but then when I use curl_multi_getcontent,</p>
  
  <pre><code>$h = curl_init();
  $headers = array(
  "Range: bytes=0-700"
  );
  curl_setopt($h, CURLOPT_URL, $url);
  curl_setopt($h, CURLOPT_HEADER, $headers); 
  curl_setopt($h, CURLOPT_RETURNTRANSFER, 1); //return the image value
  
  $mh = curl_multi_init();
  curl_multi_add_handle($mh, $h);
  
  $running = null;
  do {
     curl_multi_exec($mh, $running);
  } while ($running &gt; 0);
  
  $raw = curl_multi_getcontent($h);
  @$im = imagecreatefromstring($raw);
  </code></pre>
  
  <p>PHP will complain at the <code>@$im = imagecreatefromstring($raw);</code> line that Data is not in a recognized format</p>
  
  <p>what did I do wrong? I would like to use the multi exec option since I can then parallelize it....</p>
  
  <p>I also tried changing this line: <code>curl_setopt($h, CURLOPT_HEADER, $headers);</code>  in the multi segment into CURLOPT_HTTPHEADER just like the first one, but instead the connection was reset and once again it was due to imagecreatefromstring since after commenting that line, it didn't get reset</p>