ruby cgi, add params and redirect

D

David Susco

I'm looking for a way to add parameters to a cgi object and then
redirect the user to another cgi script off site.

-----
require "cgi"

cgi = CGI.new

cgi.params['new_param'] = "new_value"
...

cgi.header("status" => "302",
"location" => "offsite_script.cgi")
-----

I can add parameters no problem as above, but the offsite script isn't
receiving the added parameters. Is this because the redirect is
happening before the parameters are being added? Is there another way to
do this?

Thanks,
Dave
 
D

David Susco

OK, so the above isn't working because 302 is being return to the
client, which is re-sending the original params to the redirect location
(offsite_script.cgi)

I've played around with Net:HTTP this seems to be sending the data but
the user is oblivious to this. Is there a way to add params to the cgi
hash and forward the user on? Essentially I'm looking for this script
that adds params to be transparent to the user.
 
D

David Susco

Good ideas, but the offside script needs the post method and doesn't
accept parameters passed through the URL. I also don't have the ability
to change the offsite script so cookies are out as well.

Is there no way to forward a user on? This is easy enough to do on the
client side with Javascript, but if a user has scripting turned off none
of it will work.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top