Title: Use php4 to accelerate network transmission .? **************************************** * Title .........: PHP4HTTPCompressionSpeedsuptheWeb ** Version .......: 1.10 ** Author ........: catoccatoc@163.net ** Filename ......: gzdoc. php ** Lastchanged ..: 2508 Question: use php4 to accelerate network transmission.
/***************************************
** Title ......: PHP4 HTTP Compression Speeds up the Web
** Version ......: 1.10
** Author ......: catoc
** Filename...: gzdoc. php
** Last changed...: 25/08/2000
** Requirments...: PHP4> = 4.0.1
** PHP was configured with -- with-zlib [= DIR]
** Notes...: Dynamic Content Acceleration compresses
** The data transmission data on the fly
** Code by sun jin hu (catoc)
** Most newer browsers since 1998/1999 have
** Been equipped to support the HTTP 1.1
** Standard known as "content-encoding ."
** Essentially the browser indicates to
** Server that it can accept "content encoding"
** And if the server is capable it will then
** Compress the data and transmit it.
** Browser decompresses it and then renders
** The page.
** Useage ........:
** No space before the beginning of the first' .
** ------------ Start of file ----------
** | ** | Include ('gzdoc. php ');
** | Print "Start output !! ";
** |?>
** |
** |... The page...
** |
** | ** | Gzdocout ();
** |?>
** ------------- End of file -----------
***************************************/
Ob_start ();
Ob_implicit_flush (0 );
Function GetHeader (){
$ Headers = getallheaders ();
While (list ($ header, $ value) = each ($ headers )){
$ Message. = "$ header: $ value
";
}
Return $ Message;
}
Function CheckCanGzip (){
Global $ HTTP_ACCEPT_ENCODING, $ PHP_SELF, $ Wget, $ REMOTE_ADDR,
$ S_UserName;
If (connection_timeout () | connection_aborted ()){
Return 0;
}
If (strpos ('catoc '. $ HTTP_ACCEPT_ENCODING, 'gzip') | $ Wget =
= 'Y '){
If (strpos ('catoc '. $ HTTP_ACCEPT_ENCODING, 'X-gzip ')){
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.