PHP
  Home arrow PHP arrow An Object-based Approach to HTTP Compression in PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

An Object-based Approach to HTTP Compression in PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 6
    2006-04-17


    Table of Contents:
  • An Object-based Approach to HTTP Compression in PHP
  • Object-based "Gzip" compression: creating a data compressor PHP class
  • Setting up a concrete example: putting the "DataCompressor" class to work
  • Explaining the example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    An Object-based Approach to HTTP Compression in PHP
    ( Page 1 of 4 )

    Welcome to the second tutorial of the series “Using HTTP compression in PHP.” In three parts, this series demonstrates how to apply HTTP compression to parsed PHP pages, in order to reduce their overall download times, which results in faster delivery of dynamic content.

    Introduction

    Over the first tutorial of this series, I developed some hands-on examples, aimed at illustrating how "Gzip" encoding can be used within PHP scripts to compress the output generated by dynamic PHP pages. After transferring the encoded data to the client, contents are uncompressed and finally displayed on the browser.

    As you probably recall, the data encoding/decoding process that I just described  was performed by a combination of the PHP built-in "gzencode()" function and some output buffering functions. These became extremely handy for storing temporarily the dynamic output of parsed PHP files and applying "Gzip" encoding on the respective data. Indeed, output buffering control can be used as a simple mechanism for implementing different kinds of post-processing on parsed data, such as caching (X)HTML output, or compressing dynamic pages, to name a few popular applications.

    Now that the data compression methods shown in the previous article are hopefully familiar concepts to you, it's time to move toward the implementation of HTTP compression within object-oriented PHP applications, particularly, for obvious reasons, on those whose output include some sort of (X)HTML rendering process.

    By the end of this article, you should have the appropriate knowledge for building a simple data compressor class, in addition to using HTTP compression for reducing the download time of object-generated web pages. I'm sure the subject is quite interesting to you, so let's dive into the topic together.



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek