Re: Problems with output buffering and gzcompress()

From: Date: Fri, 05 Jan 2001 04:20:49 +0000
Subject: Re: Problems with output buffering and gzcompress()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-32818@lists.php.net to get a copy of this message
ok this works now :) anyone get anything working with bzip ? <? function compress_output($output) { $crc = pack('V',crc32($output)); $size = pack('V',strlen($output)); $output = gzcompress($output, 9); $data = "\x1f\x8b\x08\x00\x00\x00\x00\x00"; $data .= substr($output, 0, strlen($output) - 4); $data .= $crc; $data .= $size; return $data; } if ( ereg('gzip', $HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING']) ) { header("Content-Encoding: gzip"); ob_start("compress_output"); } ?> Chris Lee Mediawaveonline.com ""Chris Lee"" <lee@mediawaveonline.com> wrote in message news:933cp2$qbo$1@toye.p.sourceforge.net... > heres whats not working, I can get php to compress my output buffer but I > cant get my function to work in all browsers. > > //-------------------------------------------------------------------------- > --------- > header("Content-Encoding: gzip"); > ob_start("compress_output"); > //-------------------------------------------------------------------------- > --------- > > echo "hello? what? why do you say it like that?<br>\n"; > > ok there is the code > > > > > > Opera 5.01 - displays page ok, but gives a "data corrupt error" > IE 5.5 - displays blank page > Lynx 2.8.3 - everything works > Amaya 4.2.1 - everything works > Netscape 6 - everything works > //-------------------------------------------------------------------------- > --------- > function compress_output($output) > { > $output = gzcompress($output); > > $size = strlen($output); > $crc = crc32($output); > > $output = substr($output, 0, strlen($output) - 4); > > $data = "\x1f\x8b\x08\x00\x00\x00\x00\x00"; > $data .= $output; > $data .= pack("V",$crc); > $data .= pack("V",$size); > > return $data; > } > //-------------------------------------------------------------------------- > --------- > > > > Opera 5.01 - GPF's > IE 5.5 - everything works > Lynx 2.8.3 - everything works > Amaya 4.2.1 - everything works > Netscape 6 - everything works > //-------------------------------------------------------------------------- > --------- > function compress_output($output) > { > $output = gzcompress($output); > > $size = strlen($output); > $crc = crc32($output); > > $data = "\x1f\x8b\x08\x00\x00\x00\x00\x00"; > $data .= $output; > > return $data; > } > //-------------------------------------------------------------------------- > --------- > > > > Any idea's ? With one IE doesnt work, with the other Opera doesnt work. > > And all you who say "no one uses Opera" dont bother saying it. :) > > > Chris Lee > Mediawaveonline.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#32818) next »