Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
ruby cgi, add params and redirect
David Susco
9/29/2008 4:53:00 PM
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
--
Posted via
http://www.ruby-...
.
3 Answers
David Susco
9/29/2008 8:46:00 PM
0
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.
--
Posted via
http://www.ruby-...
.
Martin Boese
9/29/2008 9:46:00 PM
0
You should use cookies (maybe with cgi session), or add the paramenters to the
url, for example:
puts cgi.header('status' => 'REDIRECT',
'location' => 'offsite_script.cgi?new_param=new_value')
http://www.ruby-doc.org/core/classes/CGI/Se...
http://www.ruby-doc.org/core/classes/CGI/C...
On Monday 29 September 2008 16:52:32 David Susco wrote:
> 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
David Susco
9/30/2008 5:22:00 PM
0
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
Martin Boese wrote:
> You should use cookies (maybe with cgi session), or add the paramenters
> to the
> url, for example:
>
> puts cgi.header('status' => 'REDIRECT',
> 'location' => 'offsite_script.cgi?new_param=new_value')
>
>
>
http://www.ruby-doc.org/core/classes/CGI/Se...
>
http://www.ruby-doc.org/core/classes/CGI/C...
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
ruby cgi, add params and redirect
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password