Opening GZ Object with PHP
I haven't found similar queries, so quick question. Can you use any GZIP functions or such with PHP to read a GZIP object.
I'm basically using Amazon S3 class to get the .GZ logs, and I'm trying to parse whilst it's a loaded object, as opposed to downloading it to local and then parsing.
Is this not possible? Should I only be trying to download and 开发者_运维问答parse?
With Zlib extension (http://php.net/manual/en/book.zlib.php) you can open and write gzip compressed files on the fly.
You need to save gz file and open it with gzfile() function.
Like this
$file = gzfile('log.gz'); foreach ($file as $line) { // read it line by line }
精彩评论