title: Download zip PHP
body: <p>I'm trying to get a zip file (I don't know size and name before) with a request xml that return me a zip file. I want to download it but sometimes download it all (16mb about) sometimees not( 2mb or 4 mb or 1mb) I don't know why.</p>
  
  <p>This is my code:</p>
  
  <pre><code>$ch2=curl_init();
  curl_setopt($ch2, CURLOPT_URL, $this-&gt;URL);
  curl_setopt($ch2, CURLOPT_TIMEOUT, 5040);
  curl_setopt($ch2, CURLOPT_HEADER, 0);
  curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch2, CURLOPT_POST, 1);
  curl_setopt($ch2, CURLOPT_POSTFIELDS,$this-&gt;XMLRequest);
  curl_setopt($ch2, CURLOPT_SSL_VERIFYHOST, 1);
  curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, FALSE); 
  curl_setopt($ch2, CURLOPT_SSLVERSION, 3); 
  curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, true);
  
  $xml = curl_exec($ch2);
  
  curl_close($ch2);
  $file2 = fopen('upload/item.zip','w+');
  fwrite($file2, $xml);
  fclose($file2);
  </code></pre>
  
  <p>I have also tried: </p>
  
  <pre><code>file_put_contents('upload/item.zip', $xml);
  </code></pre>
  
  <p>Can someone help me?</p>