gzencode and stream http archive
function gzencode_stream($input, $level = -1, $mode = FORCE_GZIP) { $mode = in_array($mode, array(FORCE_GZIP, FORCE_DEFLATE, FORCE_DEFLATE), TRUE) ? $mode : FORCE_GZIP; $level = ($level = (int)$level) < 0 || $level > 9 ? -1 : $level; if (function_exists('gzdeflate')) { $mode = ($mode == FORCE_GZIP) ? FORCE_DEFLATE : $mode; } elseif (function_exists('gzencode') && $mode == FORCE_GZIP) { return gzencode($input, $level); } elseif (function_exists('gzcompress') && $mode == FORCE_DEFLATE) { return gzcompress($input, $level); } $flags = ($mode == FORCE_DEFLATE) ? FORCE_DEFLATE : 0