txkhomes
asked on
Uncompressing .gz in php file
I need to know how to uncompress a .gz file in a php script I have tried several ways but it will not uncompress the file and write it to the hard drive
What I am doing is ftp to a site grab a .gz file that has a txt file in it I need to uncompress the gz file so I can use the txt file in another php script
What I am doing is ftp to a site grab a .gz file that has a txt file in it I need to uncompress the gz file so I can use the txt file in another php script
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can anyone give the language needed to do the following
ftp to site
grab archive and write to to y directory
unzip archive to x directory
exit
ftp to site
grab archive and write to to y directory
unzip archive to x directory
exit
You could do that in any number of languages, from a shell script (or batch file), though to PHP/C++/etc.
ASKER
What I want is for it to be php and be called from a cron job
http://www.php.net is a good place to get information.
There is a set of functions that will allow you to get a files from an ftp site... Lookup "FTP"
There is a set of functions that will let you unzip gz files... Lookup "zlib"
There isn't much to it. I just don't have the time right now to write the code for you or I would.
There is a set of functions that will allow you to get a files from an ftp site... Lookup "FTP"
There is a set of functions that will let you unzip gz files... Lookup "zlib"
There isn't much to it. I just don't have the time right now to write the code for you or I would.
ASKER
I have no problem with closing this question
See this URL for the gzopen, gzread, and gzclose commands.
http://us3.php.net/manual/en/function.gzopen.php
Once you have the data in you can then write using the fopen, fwrite, fclose functions.
http://us3.php.net/manual/en/function.fopen.php
This way is more direct and it doesn't depend on certain commands being available on the system command line.