title: Open a .gz file and read/replace
body: <p>I can't find the answer I need, so I hope you understand what I'm after.</p>
  
  <p>I need to be able to open a tar.gz file (from a remote website), read the files, and copy/replace these files on my website. I've been trying this code (as well as countless other codes):</p>
  
  <pre><code>$zipFile= 'http://awebsite.com/file.tar.gz';
  $dir = 'myfolder';
  $zp = @gzopen($zipFile, "r");
  $fp = @fopen($dir, "w");
  while(!@gzeof($zp)) {$string = @gzread($zp, 4096); @fwrite($fp, $string, strlen($string));}
  @gzclose($zp);
  @fclose($fp);
  </code></pre>
  
  <p>All seem to come up with errors of different sorts. I seem to be able to read the zip file, but not actually save the contents to my website.</p>
  
  <p>Thanks for any help in advance.</p>
  
  <p>Crito</p>