开发者

Rails - redirect_to POST alternative

NOTE : Question reformulated to be more clear

I would like to simulate the sending of a fo开发者_如何学Gorm to an external domain in a controller action (like a redirect_to an external domain in POST with POST params). IE : Send the POST request with the params, and render the HTML results in the browser.

What is the best way to do it in Rails 3?


Sure, you can just execute the POST on the server side, collect the response and then do whatever you like with it. It's not unlike making a server side call to your favourite REST API and then rendering the response to the client.

You probably want to start with a library that provides a nice interface for server side POST. I'd suggest looking at https://github.com/nahi/httpclient

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜