note 105498 added to function.gzencode

From: Date: Mon, 22 Aug 2011 22:24:36 +0000
Subject: note 105498 added to function.gzencode
Groups: php.notes 
Request: Send a blank email to php-notes+get-182663@lists.php.net to get a copy of this message
Had some trouble finding the correct way to send a Content-Length header with HTTP compression. The pitch is to use gzencode (not gzdeflaten not gzcompress). <?php // disable ZLIB ouput compression ini_set('zlib.output_compression','Off'); // compress data $gzipoutput = gzencode($output,6); // various headers, those with # are mandatory header('Content-Type: application/x-download'); header('Content-Encoding: gzip'); # header('Content-Length: '.strlen($gzipoutput)); # header('Content-Disposition: attachment; filename="myfile.name"'); header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Pragma: no-cache'); // output data echo $gzipoutput; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 82.227.124.74 ---- Manual Page -- http://www.php.net/manual/en/function.gzencode.php Edit -- https://master.php.net/note/edit/105498 Del: integrated -- https://master.php.net/note/delete/105498/integrated Del: useless -- https://master.php.net/note/delete/105498/useless Del: bad code -- https://master.php.net/note/delete/105498/bad+code Del: spam -- https://master.php.net/note/delete/105498/spam Del: non-english -- https://master.php.net/note/delete/105498/non-english Del: in docs -- https://master.php.net/note/delete/105498/in+docs Del: other reasons-- https://master.php.net/note/delete/105498 Reject -- https://master.php.net/note/reject/105498 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182663) next »