OK. SO this is a simple program... more or les a set of few functions in the form of a class. This is meant gzip compression of the Output so that things are made smaller and faster. This is followed by an example at the bottom. Hope this helps you. One more point, this class is meant usually for large sites!, It wont make much diffrence for smaller ones.
IMPORTANT: READ THE COMMENTS CAREFULLY.
PHP4 HTTP Compression
Class Gzip
Author.......: leapinglangoor [ leapinglangoor@yahoo.co.in ]
Version......: 1.20
Filename.....: gzdoc.php
Updated......: 18/10/2000
Requirments..: PHP4 >= 4.0.1
PHP was configured with --with-zlib[=DIR]
Notes........: Dynamic Content Acceleration compresses
the data transmission data on the fly
code by sun jin hu (catoc) <catoc@163.net>
Most newer browsers since 1998/1999 have
been equipped to support the HTTP 1.1
standard known as "content-encoding."
Essentially the browser indicates to the
server that it can accept "content encoding"
and if the server is capable it will then
compress the data and transmit it. The
browser decompresses it and then renders
the page. This version does not require
GLOBALS to be ON. In case you encounter any
errors, please notify me.
func Gzip
Constructor
Initialise the Gzip output.
compress.php:
<?php
class Gzip
{
function Gzip()
{
ob_start();
ob_implicit_flush( 0 );
}
/*
** func CheckCanGzip
**
** Used inside the class( in GzDocOut )
** Checks if Gzip is possible
*/
function CheckCanGzip()
{
if( headers_sent() || connection_timeout() || connection_aborted() )
{
return 0;
}