Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Appendices : List of Supported Protocols/Wrappers : Compression Streams

Compression Streams

zlib: PHP 4.0.4 - PHP 4.2.3 (systems with fopencookie only)

compress.zlib:// and compress.bzip2:// PHP 4.3.0 and up

  • zlib:
  • compress.zlib://
  • compress.bzip2://

zlib: works like gzopen(), except that the stream can be used with fread() and the other filesystem functions. This is deprecated as of PHP 4.3.0 due to ambiguities with filenames containing ':' characters; use compress.zlib:// instead.

compress.zlib:// and compress.bzip2:// are equivalent to gzopen() and bzopen() respectively, and operate even on systems that do not support fopencookie.

Table O.7. Wrapper Summary

Attribute Supported
Restricted by allow_url_fopen No
Allows Reading Yes
Allows Writing Yes
Allows Appending Yes
Allows Simultaneous Reading and Writing No
Supports stat() No, use the normal file:// wrapper to stat compressed files.
Supports unlink() No, use the normal file:// wrapper to unlink compressed files.
Supports rename() No
Supports mkdir() No
Supports rmdir() No


Code Examples / Notes » wrappers.compression

joshualross

I had a difficult time finding how to use compress.zlib with an http resource so I thought I would post what I found
<?php
$file = 'compress.zlib://http://www.example.com/myarchive.gz';
$fr = fopen($file, 'rb');
?>
Per the bugreport I found here (http://bugs.php.net/bug.php?id=29045)


Change Language


Follow Navioo On Twitter
Filesystem
Socket
HTTP and HTTPS
FTP and FTPS
PHP input/output streams
Compression Streams
Data (RFC 2397)
Secure Shell 2
Audio Streams
Process Interaction Streams
eXTReMe Tracker