预判压缩,如果支持压缩则优先使用
$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>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用@来通知其他用户。