It's remarkably complicated. Maybe curl can, or the PEAR http client.
In order to keep the connection alive, you need to use HTTP 1.1
And in order to use HTTP 1.1, your implementation MUST accept chunked transfer-encodings in the response.
I strongly recommend you evaluate a few HTTP libraries - bear in mind that some of the ones written in PHP may have incorrect HTTP 1.1 implementations, which could easily appear to work on some sites but corrupt the data in other cases because of misunderstanding chunked responses (which they MUST accept, according to the HTTP 1.1 spec).
Mark