Jump to content

Displaying Transfer-Encoding: chunked data as it arrives


thinkspill

Recommended Posts

I'm trying to write a script that reads from a URL which, for example's sake, sends data at 5 second intervals. As the server sends each chunk of data I want to echo that data to the page.

 

So far I've only been able to display the data after all of it has been sent, but not as it arrives in the 5 second intervals.

 

Any ideas?

Link to comment
Share on other sites

Try ob_implicit_flush() and ensure that zlib output compression and mod_gzip are not active on your page.  You can check that by checking the headers in your browser (For example, using live http headers  extension in firefox)

 

Simply printing at 5 second intervals is not enough, as php will cache the data and send it in larger chunks by default.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.