From: James Britt Date: 2006-02-10T02:33:28+09:00 Subject: Re: Passing POST params from one rhtml to another Belorion wrote: > Greetings everyone. I am faced with a rather tricky problem. I have > mod_ruby/eRuby going on Apache, and have the following situation: > > I have an outer rhtml file which, using the open-uri library, opens up a > remote rhtml file from one of my other servers to dump the contents inside > the outer rhtml. In other words, I have 1 rhtml wrapping another one from > my other remote site. > > Unfortunately, I also need to pass POST data from a form to the inner > rhtml. So, the outer rhtml recieves the POST data and can be used using > CGI.new, but I don't know how to pass the same post data to the inner rhtml > file. Can you use open-uri to send an HTTP POST request? (from: http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/) open("http://www.ruby-lang.org/en/", "User-Agent" => "Ruby/#{RUBY_VERSION}", "From" => "foo@bar.invalid", "Referer" => "http://www.ruby-lang.org/") {|f| ... } Could the headers hold the post metadata? "Content-Length" => some_base64_encoded_stuff.size "Content-Type" => "application/x-www-form-urlencoded" I believe the some_base64_encoded_stuff part has to go in the body of the request, though. I don't know if open-uri provides for that. If not, then use a library than can do a POST, such as net/http. -- James Britt "A language that doesn't affect the way you think about programming is not worth knowing." - A. Perlis