1

预判压缩,如果支持压缩则优先使用

$header[]="Accept-Encoding:compress,gzip";
curl_setopt($curl_session,CURLOPT_HTTPHEADER,$header);

捕捉档案并且压缩范例

include("LIB_http.php");

// define the page
$target="http://xxx";
$ref="";
$method="GET";
$data_array="";
$web_page=http_get($target,$ref,$method,$data_array,EXCL_HEAD);

// 得到捕捉到的档案,并且进行压缩,并且输出压缩前后的大小
$unzip_size=strlen($webpage['FILE]);
$zip_size=strlen(gzcompress($web_page['FILE'],$compression_value=9));
//$noformat_size=strlen(strip_tags($web_page['FILE']));//strip_tags移除HTML标签
// 还可以添加trim移除所有空格

输出一张显示用的HTML表格(size)


<!DOCTYPE html>
<html lang="en">
<head>

<title>Welcome to Omoikane</title>
</head>
<body>

Compression report for
Unzip zip
bytes bytes

</body>
</html>



</body>
</html>

Key君_ziying
297 声望13 粉丝

Who dares win.