Here are a couple of sample headers so you can see what they are.
From Browser:
POST /PageManagerS HTTP/1.0
Content-Type: application/x-www-form-urlencoded
Host: <b>HOST DELETED</b>
Cookie: JSESSIONID=O0nhWr47K5Gppe5sdE1xm5FCzVFmljG9K2481I5b4YqFNph4uLdf!-9178302153101245298!-772441722!80!443;
Content-Length: 75
event_id=2**2001&association_id=2**&requester_id=CC&page_id=3
Above is what my browser sent to this particular server, as you can see by the first line this was a POST request to the /PageManagerS program using the HTTP/1.0 specification. The request was sent from a form, that's what the Content-Type line says. I removed the HOST for security reasons, but that would be something like www.phpbuilder.com. My browser also sent a cookie. The Content-Length line tells the server that I'm sending 75 characters in POSTED data to them. And then finally there is the posted data.
From Server:
HTTP/1.1 200 OK
Date: Mon, 09 Jul 2001 16:53:57 GMT
Server: WebLogic 6.0 Service Pack 1 03/04/2001 22:05:05 #101616
Content-Length: 6058
Content-Type: text/xml
Connection: Close
So here is what the server sent back to me, minus the XML that it says it's going to send. So first the server tells me I'm getting HTTP/1.1 data, the 200 OK is the servers response to my request telling me that everything is fine and I'm going to get stuff back. The second line is the date. The third line tells me what server I'm communicating with, in this case a WebLogic server. Next is that Content-Length line which tells me that I'm getting 6058 characters. The Content-Type line tells me the mime type of the data I'm getting so that my browser can display it properly. And finally I'm told the server is closing the connection (that is always the last line of the header). After that I'll get the XML that I requested.
Using the header() function in PHP allows you to put information into the header that you are sending to the browser. As long as you haven't sent anything to the browser before it you can use the header() function. This will allow you to add items to the header for the browser to use. The most common use fo the header() function that I've seen is to send the Location: header to redirect the user seemlessly to a new page. To see this in action go to www.yahoo.com, and click on the finance link. Look at where the link points to before you click, and then check the URL where you end up. Yahoo's entire site is built using the Location: header to move you around seemlessly and to track where you are going and comming from.