in reply to Passing POST parameters

Sorry, turnstep, I already use that code, but I don't want to have a form, I need to be able to just redirect the browser attaching some post content

Also, the server I'm on does not allow using sockets. I'd like to able to just use the
print "Location: http://www.server.com/cgi-bin/post_form.pl\n\n";

Replies are listed 'Best First'.
RE: Re: Passing POST parameters
by chromatic (Archbishop) on Apr 04, 2000 at 19:02 UTC
    I think turnstep's FORM method is the way to go. The browser will probably dump any POST data if you do a redirect (I'm sure of it). The only possible solution I can come up with is writing some sort of proxying server in the first script, in which case you're back to using LWP as btrott suggested.

    There may be a JavaScript way to avoid displaying the form and the Action button for the user, but that's beyond the realm of this lowly Perl Monk.

RE: Re: Passing POST parameters
by turnstep (Parson) on Apr 04, 2000 at 19:11 UTC

    Well, you can't do it with a Location redirect, I'm afraid. The only thing you can pass through that is a URL, which might happen to have some GET data embedded inside it. It's still not exactly clear what you are trying to do. The only way to send the information as a POST request is to connect to the web server, send the header information, including the length of your data, then send the data itself, and close the connection. That's basically what a web browser does, and what some of the above-mentioned modules can help with.

    I'm going to make a wild stab here: you would like people to be able to click on a normal link (with GET information encoded) and have the server somehow redirect them to another script in which the information is sent only via POST and not in the new URL? If so, you can simulate that connection by having your script connect to the new website, deliver the data as POST, and dump the results back to the person browsing. The only other way would be to have your script output a page in which they could hit a submit button and do it themselves. But there is no way to force/trick a browser to send post information without user interaction (e.g. clicking on the submit button)