note 61961 added to function.gzcompress
| From: | prgTW at poczta dot onet dot pl | Date: | Thu, 16 Feb 2006 01:57:48 +0000 |
| Subject: | note 61961 added to function.gzcompress | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103823@lists.php.net to get a copy of this message | ||
I don't know why, but W3C Validator can't validate pages that are GZIP compressed (with
functions posted below: gzcompress, pack etc.; not by ob_gzhandler).
Because of this, I use similar code to this below:
<?php
if( strstr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')!==false ||
strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')===false ){
// do not compress
}else{
// can send GZIP compressed data
}
?>
This code also checks if user agent is W3C Validator. If it is NOT W3C Validator and user acceptes
GZIP encoded data then we can compress the page, in other case if it is W3C Validator or user agent
does not accept GZIP enoded data we can't compress the page, 'cause user agent
couldn't properly handle it.
Sorry for my bad English
----
Server IP: 81.223.254.85
Probable Submitter: 83.5.203.123
----
Manual Page -- http://www.php.net/manual/en/function.gzcompress.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61961
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61961&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61961&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61961&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61961&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61961&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61961&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61961&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61961&report=yes
Search -- http://master.php.net/manage/user-notes.php