0

I am trying to send/receive requests using PHP's fsockopen().

I just wanted to ask what are the required headers for different types of HTTP methods?

these are Google's response header

HTTP/1.0 200 OK => 
Date => Mon, 14 Jan 2013 08:21:29 GMT 
Expires => -1 
Cache-Control => private, max-age=0 
Content-Type => text/html; charset=ISO-8859-1 
Set-Cookie => NID=67=LI2GVi9aUXjLjdpqEs4zbEwYAWmMsW_5CQBWKeR-cohs2CLBSGN7rXqFplRNGxiF2oOZpGWR1mvBPhX7Eak4nmkNERiwPiitJNc0ub4kCxKZt64zvxcZXaeIjdANAWDa; expires=Tue, 16-Jul-2013 08:21:29 GMT; path=/; domain=.google.com; HttpOnly 
P3P => CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info." 
Server => gws 
X-XSS-Protection => 1; mode=block 
X-Frame-Options => SAMEORIGIN

can you give me a hint what headers are required in order to make a request?

kapitanluffy
  • 1,269
  • 7
  • 26
  • 54

1 Answers1

0

This is not easy topic, but you will probably find best answer in RFC2616 which standarizes HTTP/1.1 protocol.

http://www.w3.org/Protocols/rfc2616/rfc2616.html

Mariusz Sakowski
  • 3,232
  • 14
  • 21
  • 1
    Actually, it's a pretty easy topic. HTTP/1.0 requires no headers and HTTP/1.1 requires only the HOST header, everything else is not required. Content-Length should be sent if the request has a body and you're supporting keep-alive (without connection:close in 1.1 or through connection: keep-alive in 1.0) – Benjamin Gruenbaum Jan 14 '13 at 08:35
  • ok let me rephrase the question. what headers should be (though not required) in a request/response? – kapitanluffy Jan 14 '13 at 09:28