PHP
  Home arrow PHP arrow Page 8 - Output Buffering With PHP
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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? 
PHP

Output Buffering With PHP
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 56
    2002-04-30

    Table of Contents:
  • Output Buffering With PHP
  • The Matrix Awaits
  • Start Me Up
  • Melting Down
  • Today's Forecast
  • Making It Simpler
  • The Real World
  • Zip Zap Zoom
  • Endgame

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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


    Output Buffering With PHP - Zip Zap Zoom


    (Page 8 of 9 )

    With everyone and their grandma now online, Web site are making an effort to provide users with more and better content. However, with bandwidth and download time still issues, it's essential that Web developers ensure this content is made available to the end-user as quickly as possible.

    PHP's output control API offers an interesting solution to the problem, making it possible to compress the output sent to the client on-the-fly to reduce download time. Of course, the client needs to support this - but if it does, using this feature can make your Web site more efficient and your users happier.

    Here's an example:

    <?phpob_start("ob_gzhandler");?><html><head></head><body><!-- content goes here --><!-- content goes here --></html></body><?phpob_end_flush();?>
    In this case, I've specified a callback function for the output buffer. For once, this callback is not a user-defined handler; rather, it is a PHP function named ob_gzhandler() whose sole purpose is to determine whether the client can accept compressed data (via the Content-Encoding header). If it can, ob_gzhandler() compresses the contents of the output buffer and sends it to the client, which then decodes and renders it; if not, the data is sent as is, in uncompressed form.

    More PHP Articles
    More By Harish Kamath, (c) Melonfire


     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT