Re: [PHP-DEV] PHP 4.0 Bug #7033 Updated: gzcompress does not work as expected From: Denis Philippov (denis <email protected>)
Date: 10/17/00

Try this snippet:

$content = "Some test string.";
$gzheader=chr(0x1F).chr(0x8B).chr(0x08).chr(0x00).chr(0x00).chr(0x00).chr(0x
00).chr(0x00).chr(0x00).chr(0x03);
$crc=putLong(crc32($content));
$len=putLong(strlen($content));
header("Content-Encoding: gzip");
echo $gzheader.substr(substr($content, 0, strlen($content)-4).$crc.$len, 2);

function putLong ($long){
 for ($n = 0; $n < 4; $n++) {
  $ret.=chr((integer)($long & 0xff));
  $long = $long >> 8;
 }
 return $ret;
}

With best wishes,
Denis, webmaster <email protected>

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>