<? /*************************************** ** Title.........: PHP4 HTTP Compression Speeds up the Web ** Version.......: 1.10 ** Author........: catoc <[email protected]> ** Filename......: gzdoc.php ** Last changed..: 25/08/2000 ** Requirments...: PHP4 >= 4.0.1 **/t/t PHP was configured with --with-zlib[=DIR] ** Notes.........: Dynamic Content Acceleration compresses **/t/t the data transmission data on the fly **/t/t code by sun jin hu (catoc) <[email protected]> **/t/t Most newer browsers since 1998/1999 have **/t/t been equipped to support the HTTP 1.1 **/t/t standard known as "content-encoding." **/t/t Essentially the browser indicates to the **/t/t server that it can accept "content encoding" **/t/t and if the server is capable it will then **/t/t compress the data and transmit it. The **/t/t browser decompresses it and then renders **/t/t the page. ** Useage........: **/t/t No space before the beginning of the first '<?' tag . **/t/t ------------Start of file---------- **/t/t |<? **/t/t | include('gzdoc.php'); **/t/t | print "Start output !!"; **/t/t |?> **/t/t |<HTML> **/t/t |... the page ... **/t/t |</HTML> **/t/t |<? **/t/t | gzdocout(); **/t/t |?> **/t/t -------------End of file----------- ***************************************/ ob_start(); ob_implicit_flush(0); function GetHeader(){ /t$headers = getallheaders(); /twhile (list($header, $value) = each($headers)) { /t/t$Message .= "$header: $value<br> "; /t} /treturn $Message; } function CheckCanGzip(){ /tglobal $HTTP_ACCEPT_ENCODING, $PHP_SELF, $Wget, $REMOTE_ADDR, $S_UserName; /tif (connection_timeout() || connection_aborted()){ /t/treturn 0; /t} /tif ((strpos('catoc'.$HTTP_ACCEPT_ENCODING, 'gzip')) || $Wget = = 'Y'){ /t/tif (strpos('catoc'.$HTTP_ACCEPT_ENCODING, 'x-gzip')){