in reply to HTTP Header not working

Quite simply, the HTTP spec dictates the request must start with the request-line (e.g. "GET ..."), not a blank line. Why don't you use LWP instead of (incorrectly) reinventing the wheel?