at 2010-01-08
in Examples
by friebe
(0 comments)
To reduce bandwidth some servers have their content zipped using solutions such as Apache's mod_deflate. This is done only if the Accept-Encoding request header contains the string gzip. Combining the XP Framework's peer.http API with the new io.streams.GzDecompressingInputStream one can accomplish this compression:
<?php $conn= new HttpConnection($args[0]); $response= $conn->get(array(), array('Accept-Encoding' => 'gzip')); if ('gzip' == $response->getHeader('Content-Encoding')) { $in= new GzDecompressingInputStream($r->getInputStream()); } else { $in= $r->getInputStream(); } ?>
|
Subscribe
You can subscribe to the XP framework's news by using RSS syndication.
CategoriesNews General PHP5 Announcements RFCs Further reading Examples Editorial EASC Experiments Unittests Databases 5.8-SERIES
RelatedFind related articles by a search for «Reading».
|