The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 11:40:49 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: ungz.php how to extract a .gz file through php  (Read 4388 times)
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« on: April 01, 2009, 10:23:05 AM »

I dont know the entire scope of what a gz is or could be but this at least unzipped it for me:

requires zlib to be enabled.

Code:
<?php
 $handle 
fopen('unzippedfile.txt''a');
 
$zh gzopen('bbigassfilesql.gz','r') or die("can't open: $php_errormsg");
 while (
$line gzgets($zh,1024)) {
    
// $line is the next line of uncompressed data, up to 1024 bytes 
    
fwrite($handle$line);
  }
 
gzclose($zh) or die("can't close: $php_errormsg");
 
fclose($handle);
?>


Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!