Forum Moderators: coopster
$gzip_contents = ob_get_contents();
ob_end_clean();$gzip_size = strlen( $gzip_contents );
$gzip_crc = crc32( $gzip_contents );$gzip_contents = gzcompress( $gzip_contents, 9 );
$gzip_contents = substr( $gzip_contents, 0, strlen( $gzip_contents ) - 4 );echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack( 'V', $gzip_crc );
echo pack( 'V', $gzip_size );
I want to implement the caching from this tutorial someone from here pointed me to on the sitepoint forums, under the heading Chunked Buffering
www.sitepoint.com/article/php-anthology-2-5-caching/2
The tutorial wants me to add a ob_end_clean, but I already am using it in the gzip code, how would I mix these two together if that is even possible?
if( $do_gzip_compress ) {
ob_clean();
ob_start();
ob_implicit_flush(0);echo $header . $body . $footer;
$gzip_contents = ob_get_contents();
ob_end_clean();$gzip_size = strlen( $gzip_contents );
$gzip_crc = crc32( $gzip_contents );$gzip_contents = gzcompress( $gzip_contents, 9 );
$gzip_contents = substr( $gzip_contents, 0, strlen( $gzip_contents ) - 4 );echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack( 'V', $gzip_crc );
echo pack( 'V', $gzip_size );
}
else {
ob_end_clean();
echo $header . $body . $footer;
}
I think I got it working.