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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.