Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function output_gz_compressed($contents)
- {
- if (stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== False)
- {
- $contents = gzcompress($contents, 9);
- //remove old crc
- $contents = substr($contents, 0, strlen($contents) - 4);
- header('Content-Encoding: gzip');
- header('Content-Length: ' + strlen($contents));
- //gzip header
- echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
- echo $contents;
- echo pack('V', crc32($contents));
- echo pack('V', strlen($contents));
- }
- else
- echo $contents;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement