Click to See Complete Forum and Search --> : HTTP Header question


motowater
05-21-2008, 10:16 PM
Here is my situation:
http://site.com/a.php
http://site.com/b.php
http://site.com/c.php

upon calling a.php i want to use header("Location: http://site.com/b.php") in order to forward the user to that page. My dilemma is i need to be able to send the content of b.php to c.php. I dont know enough about the http protocol to know exactly how I could do this, maybe someone else does? I was reading up on the RFC and it was hard for me to understand what the content-location header does, but I think it does what I am requesting.

I tried:
header("Content-Location: http://site.com/c.php");
header("Location: http://site.com/b.php");
to no avail. Can anyone enlighten me? Thanks.

NogDog
05-21-2008, 11:37 PM
I have not seen any reliable way to send post data via header(). You can send get data by appending a URL query string to the URL (which is not desirable if that data may have side-effects -- i.e. you don't want that URL with all the data to be bookmarked), or you can simply use PHP sessions, putting the data into $_SESSION (which includes the benefit of not having any practical size limits on the amount of data stored).

NogDog
05-21-2008, 11:39 PM
PS: Another alternative is to abandon the 3 separate pages approach, and instead use one controller page with conditional logic to include the different scripts depending on the status of the "page" sequence.

motowater
05-21-2008, 11:58 PM
You are misinterpreting my question, i am asking nothing about sending post data. After redirecting a.php to b.php, I want the contents of b.php to be sent to c.php. On a side note what you say is not possible, is actually possible by using a 307 redirect you can redirect post data. I guess I know more than I thought. :)

NogDog
05-22-2008, 12:28 AM
Afraid I'm rather in the dark here as I don't understand the underlying reason for what you want to do in the first place, I guess. Maybe b.php just needs to do a PHP include() or readfile() of c.php? Maybe you just need to do a little URL rewriting at the web server level? Maybe I have no idea what you are talking about?