I''m trying to send http post request in the controller to a web address. In my application I''m using ajax to communicate with the controller, and then use the controller to pass the message on to a remote server, something you can''t do using ajax because of browser security problems. Just wondering what the syntax for a http post is in rails. Thanks Alex -- Posted via http://www.ruby-forum.com/.
Check out http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html Essentially, you can require ''net/http'' then set up your headers and such before performing a resp, data = http.post(path, data, headers) Cheers, ~William http://www.railshosting.org -- Posted via http://www.ruby-forum.com/.
On 3/5/06, Alexander MacCaw <maccman@gmail.com> wrote:> I''m trying to send http post request in the controller to a web address. > In my application I''m using ajax to communicate with the controller, and > then use the controller to pass the message on to a remote server, > something you can''t do using ajax because of browser security problems. > Just wondering what the syntax for a http post is in rails.It isn''t really Rails. It''s part of the Ruby standard library. http://stdlib.rubyonrails.org/libdoc/net/http/rdoc/classes/Net/HTTP.html