any small exemple of this plz?

let's take filesonic as an exemple for the rest of this topic discussion.

1) and 2) Open the stream to the direct link. --> ok, opening the direct link (http://srv1337.filesonic.com/4546546...sired_file.rar) with php cURL and sending the authorized cookie.txt via CURLOPT_COOKIEFILE
3) why read the response header?
4) ok, sending headers as content-disposition attachment and force-download or stream-octet
5) this is what i don't know how to do. how to stream? how to chunks the data?

thank you.
i only know php. no perl/cgi/c etc