PHP Classes

HV HTTP Multipart: Push multiple pages to browser in one HTTP request

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 52%Total: 1,793 All time: 2,187 This week: 673Up
Version License Categories
hv_httpmultipart 1.0.0GNU General Publi...HTTP, Video
Description 

Author

This class is meant to compose and serve multiple pages that replace each other in a single HTTP request.

It uses the MIME content type multipart/x-mixed-replace content type to keep the connection open. Only works in browsers that support that content type, obviously. This does not include MS Explorer.

It can send multiple pages that replace each other even with different content types. It can iterate over a set of pages that are deliver one after the other waiting a given interval period.

It can be used to show the progress of lengthy tasks or exhibit animations and slideshows.

Innovation Award
PHP Programming Innovation award nominee
June 2004
Number 7


Prize: One book of choice by O'Reilly
The HTTP protocol can be used to serve content in ways that are not very well known. One of such ways is to use MIME multipart content types.

The multipart/x-mixed-replace content type allows to serve a sequence of distinct content objects that replace each other within the same HTTP request. This means that the same page can display different content parts that appear successively.

Since each part may be served with wait intervals that are defined by the script that serves the page, this can be used for pushing new content once it is made available on the server, thus without having the user or the browse to issue a new request.

Despite it is a feature that is not supported by all browsers, it can be used for event driven applications that depend on events that may occur on the server side besides others that occur on the client side.

This class provides a solution for creating these multipart replacement content type parts without having to understand too much about the technical details of the protocol.

It comes with illustrating examples that show how to generate server based animations or replace content after a given period of time producing interesting slideshow effects.

Manuel Lemos
Picture of Herman Veluwenkamp
Name: Herman Veluwenkamp <contact>
Classes: 11 packages by
Country: New Zealand New Zealand
Age: ???
All time rank: 281 in New Zealand New Zealand
Week rank: 206 Down3 in New Zealand New Zealand Down
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files (14)  
File Role Description
Accessible without login Plain text file demo_iteration.php Example Demo 3 - poor man's animation
Accessible without login Plain text file demo_processing.php Example Demo 1 - for pages that take a long time to process.
Accessible without login Plain text file demo_xul.php Example Demo 2 - two pages with different content types
Plain text file HV_HttpMultipart.php Class Main class
Accessible without login HTML file page_1.html Data Page 1 for iteration
Accessible without login HTML file page_2.html Data Page 2 for iteration
Accessible without login HTML file page_3.html Data Page 3 for iteration
Accessible without login HTML file page_4.html Data Page 4 for iteration
Accessible without login HTML file page_5.html Data Page 5 for iteration
Accessible without login HTML file page_6.html Data Page 6 for iteration
Accessible without login HTML file page_7.html Data Page 7 for iteration
Accessible without login Plain text file page_finished.xul Data Page that displays 'Finished' in XUL markup
Accessible without login HTML file page_ok.html Data Page that displays 'OK'
Accessible without login HTML file page_processing.html Data Page that displays 'Processing'

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,793
This week:0
All time:2,187
This week:673Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:70%StarStarStarStar
Tests:-
Videos:-
Overall:52%StarStarStar
Rank:2448