title: Need php script to download a file on a remote server and save locally
body: <p>Trying to download a file on a remote server and save it to a local subdirectory.</p>
  
  <p>The following code seems to work for small files, &lt; 1MB, but larger files just time out and don't even begin to download.</p>
  
  <pre><code>&lt;?php
  
   $source = "http://someurl.com/afile.zip";
   $destination = "/asubfolder/afile.zip";
  
   $data = file_get_contents($source);
   $file = fopen($destination, "w+");
   fputs($file, $data);
   fclose($file);
  
  ?&gt;
  </code></pre>
  
  <p>Any suggestions on how to download larger files without interruption?</p>