Re: Header() - POST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5 Sep 2008, at 16:43, Dan Joseph wrote:
I am trying to figure out how to build a post string, and then user header
to post it.  I've done some research and I am not getting very far.

Basically what I'm doing is taking POST items, then validating them,
scrubbing them, and rebuidling the post string and trying to resubmitt it
using headers().  I'm getting this error:
ErrorCGI ErrorThe specified CGI application misbehaved by not returning a
complete set of HTTP headers.

Here is my header code, and the post string below it. I don't have any idea
what I'm missing or doing wrong.  Any help is appreciated!

header( "POST /v2/order_submitorder.php HTTP/1.0" );
header( "Host: new.vtusa.com" );
header( "Content-Type: application/x-www-form-urlencoded" );
header( "Content-Length: " . strlen( $post_string ) );
header( $post_string );

You're trying to post to the browser which won't know how to handle it. The header() function is modifying the response headers that are being sent back to the browser, they do not create a new request.

If you want to do a new request I suggest looking at curl. If you actually want the browser to make the new request the only way is to return a hidden form and auto-submit it with JS. However, as someone else pointed out if that second request is coming back to the same server there probably isn't any need for a second request at all.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux