3) - So you know what content-length to send to your client
4) Ok, + content-length
5) I've went through KWWH and it seems nobody posted this part. So I assume it's a secret.. So I keep my mouth shut. But I'll give you a place to start: http://www.php.net/manual/en/function.curl-setopt.php