Home arrow PHP arrow Page 3 - HTTP Headers in Web Development

How Headers Are Used - PHP

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.

TABLE OF CONTENTS:
  1. HTTP Headers in Web Development
  2. What do HTTP headers look like?
  3. How Headers Are Used
  4. Examples of HTTP Header Usage
By: John Best
Rating: starstarstarstarstar / 14
August 26, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

This is nice to know, but how can it be used? Is there some way to set the HTTP response headers? Can one just put them at the top of a web page?

We will address these questions in reverse order.

Can one put HTTP headers at the top of a web page? Not as such, but there is a Meta tag that can be used in the head section of a web page that provides the same functionality, and uses the same syntax. This is the http-equiv tag. This is an example:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Notice that it looks very similar to the Content-Type: header in the response that was returned by Google in the example above.

Is there some way to set the "real" HTTP response headers? There are two ways to set them. The first is to set them in the server configuration directives. And the second method is to set them using a web scripting language such as PHP, or Perl.

How can HTTP headers be used in web development? There are numerous uses, both for communication between web page and browser, and communication between web pages.

In the next section, I will provide you with a few examples of the many uses of HTTP headers.



 
 
>>> More PHP Articles          >>> More By John Best
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap

Dev Shed Tutorial Topics: