Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6471263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:12:14+00:00 2026-05-25T06:12:14+00:00

Here’s an excerpt from a Wikipedia article: In contrast to the GET request method

  • 0

Here’s an excerpt from a Wikipedia article:

In contrast to the GET request method where only a URL and headers are
sent to the server, POST requests also include a message body.

Based on that, it looks like the URL is sent separately from the header, but if that’s so, why do we use the header() method in PHP to set a URL to redirect to?

header("Location: http://google.com");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:12:14+00:00Added an answer on May 25, 2026 at 6:12 am

    When you want to browse an URL from your browser you type an URL. The browser puts the url inside an HTTP REQUEST like this:

    GET /path/to/resource.php?var=data1&othervar=data2 HTTP/1.1
    Host: example.com
    Connection: keep-alive
    "empty line"
    

    Then a webserver gives you an answer like this:

    HTTP/1.0 200 OK
    Date: Fri, 02 Sep 2011 14:37:36 GMT
    Server: Apache
    Cache-Control: private, s-maxage=0, max-age=0, must-revalidate
    Content-Encoding: gzip
    Vary: Accept-Encoding
    Content-Length: 149
    Content-Type: text/javascript; charset=utf-8
    Connection: keep-alive
    "empty line"
    "149 bytes of Response data"
    

    Every line like this “Header-Name: header_value\r\n” is an header.
    PHP header function adds an header to the response before sending it to user’s browser.
    In your example the header is:

    Location: http://google.com
    

    And it’s added just after the last header before the “empty line” (which is a line which contains only a \r\n).

    POST requests are different from GET requests because you have a request body after the “empty line”):

    POST /path/to/resource.php HTTP/1.1
    Host: example.com
    Connection: keep-alive
    Content-Length: "number of bytes in the body"
    "empty line"
    variable=data&othervar=data2
    

    In conclusion an HTTP request is made like this:

    1. Request/response row (POST or GET followed by url and http version for request, Http version followed by response code and response string for the response) ended with \r\n
    2. Request/response headers (header-name: header_value\r\n)
    3. empty row (\r\n)
    4. Response/request body

    PS. Rows are ALWAYS closed by “\r\n” bytes (“empty lines” are made of just those two bytes).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
Here's my scenario. I've got SharePoint 2010 running on one server, with an SQL
Here's a dump of the stats provided my mod_pagespeed from one of my sites.
Here is my query: SELECT * FROM [GeoName] WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005 ORDER BY
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here's my code: // Not all headers are relevant to the code snippet. #include
Here's what I'm trying to accomplish with this program: a recursive method that checks
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here's a basic regex technique that I've never managed to remember. Let's say I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.