Re: Relocating and POSTing

From: Date: Thu, 10 Jul 2008 23:55:13 +0000
Subject: Re: Relocating and POSTing
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-276633@lists.php.net to get a copy of this message
Shawn McKenzie wrote:
Daniel Brown wrote:
On Thu, Jul 10, 2008 at 2:32 PM, Richard Heyes <richardh@phpguru.org> wrote:
1. Use the query string. Eg header('Location: http://www.xxx.com?name=value&name2=value2');
    That's GET, not POST, as the subject requests.  ;-P
2. Use sessions
    .... if you're not trying to POST the data and are staying within
the same domain on the same server. ;-P
With all that in mind, if you must POST then you can do something like this: $data = addslashes("yourvar=$yourdata&secondvar=$moredata"); //just like get header('POST /some/path/to/somefile.php HTTP/1.1'); header('Host: www.example.com'); header("Content-Type: application/x-www-form-urlencoded"); header("Content-Length: " . strlen($data)); header($data); -Shawn
Have you tried it? I very much doubt that would work, considering neither GET nor POST are valid in a RESPONSE (which is what you're sending), they're only valid in REQUEST headers (which you're not in right now, that's the browser's domain)

« previous php.general (#276633) next »