'Replicating passthru (possibly with proc_open?)

I use passthru() to send data from an external program to the client browser.

The thing is, some times, there are no data being sent for a long time. And if the client disconnects, my PHP script won't know that the client disconnected. Thus the program continues running. passthru doesn't give enough control over the connection, and I can't send periodical bytes to the client.

How can I replicate the behaviour of passthru but with more control over the data?

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source