Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2006
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Curious, Why did they call it Header

    To redirect, or go to another page you use header();

    To me that sounds like a heading, header, and head, of a page.
    Footing, Footer, foot.

    Is header the only one to redirect?
    I just wonder because it seems weird.

    This isn't ActionScript but it seems more logical to say GoToFrame(); and the like. Sorry the PHP Manual doesnt tell me WHY they do what they do all the time.

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    When you make a request to a web-server for a page, it gives you back (normally, for a '200' successful request) 2 things, the 'content' of the page you requested, and a 'header' that contains meta-information, such as the content-type (whether it's HTML, a word document, an image etc.), when the page should expire (to help things get cached for a sensible amount of time), and so on.

    When you want to redirect, you send back a header with a '3XX' status code (http://en.wikipedia.org/wiki/List_of_HTTP_status_codes) indicating to the client (the web-browser) that there's not actually any content at the location they requested, but if they try somewhere else, they'll get it. That somewhere else is the 'location' that you include as part of the redirect.

    header() then, isn't just for redirecting (although that is very common), but allows you to set arbitrary http-headers that can affect how the content your serving is treated by the client.
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    You can use this site to see what HTTP headers servers are sending.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •