News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Experts Round Table:
HTTP Headers and the PHP header() Function
June 23, 2006 @ 06:16:18

From the Experts Round Table, there's this extended reference with an overview of HTTP headers (format and what raw HTTP connections look like) and what that means for PHP's header() function.

Many beginning and intermediate PHP programmers seem to think the header() function is some kind of strange voodoo. They work from examples and code snippets and are able to get things done with it, but they don't know quite how it works. That was certainly the way I regarded header() the first time I saw it.

In reality, it's quite simple. In this tutorial, I'll explain a little about how HTTP headers work, how they relate to PHP, and a little about their meta tag equivalents.

They go on to talk about what the HTTP protocol/headers are and how to "see the whole conversation" by telneting into a server on port 80. They explain what role the headers play in this. The rest of the tutorial goes into detail on PHP's header function. They mention redirection, refreshing the page after a few seconds, preventing page caching, and sending along the Content-type header to correctly identify the contents of your page (including things like dynamic images).

They also include (too) brief section covering the fact that some of the $_SERVER variables influenced by the HTTP headers should not be trusted. They specifically mention HTTP_REFERER.

0 comments voice your opinion now!
tutorial header function http meta tag telnet tutorial header function http meta tag telnet


blog comments powered by Disqus

Similar Posts

Rob Allen's Blog: Updated Tutorial for Zend Framework 1.5

Refulz.com: Traits - Method Precedence and Conflict resolution

Think Vitamin Blog: Getting Started with OOP & PHP5: Part 2

Mike Naberezny's Blog: Wrapping PHP Functions for Testability

Zend Developer Zone: Managing CSS and JavaScript files within a Zend Framework App


Community Events

Don't see your event here?
Let us know!


performance application interview composer php7 opinion release version podcast example api symfony2 library community series voicesoftheelephpant introduction framework testing laravel

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework