开发者

How to use a CGI to redirect from an HTML page to another using POST?

开发者 https://www.devze.com 2023-02-11 00:19 出处:网络
I want to send parameters to a page via a redirect using a ruby CGI script; however, I want to do it as a post if possible (ie. not pass a parameter string in the URL). I have it working using a param

I want to send parameters to a page via a redirect using a ruby CGI script; however, I want to do it as a post if possible (ie. not pass a parameter string in the URL). I have it working using a parameter string in the URL using the code below开发者_运维知识库.

def redirect( new_page )
    print "Location:#{new_page}\n\n"
end

redirect("aPage.html?name=bla&something=else");


As far as I have been able to research, I have not found a way to do this. One way around this without doing an html redirect is to open the html file in your CGI script and print it as you would when your CGI is generating the html. The only catch here is that you will have the URL to your CGI script in the address bar, it may be possible to do a redirect using .htaccess (though I can't say for sure if that will work).

Hope this helps! :-D

0

精彩评论

暂无评论...
验证码 换一张
取 消