At this point, you may not know what HTTP headers are, but you use them all the time, both as an Internet user and as a web developer, even if you are not aware of it. The beginning of this article is a short introduction to HTTP headers, including what they are, and what they do. Later in the article, we cover some common uses of HTTP headers in web development.
PHP will be the scripting language used in the examples.
What Are HTTP Headers?
HTTP headers are an Internet protocol, or set of rules for formatting certain types of data and instructions that can be sent along with a request from a web client or browser, or sent by the server along with a response to a browser. In simpler terms, an HTTP header is a few lines of code that carries information between a browser and a Web server.
HTTP headers are used for communication between the client and server in both directions. They are sent by the client or browser along with the request to the server for a web page or other resource. The resource is usually either a file or dynamic output from a server side script. In the other direction they are sent by the server along with its response to the browser or client request.