David Susco | 29 Jun 20:46 2011
Picon

sending a post request from a controller

What's the cleanest way to do this? With Net::HTTP? I have a form
that's sent to a controller and validated. If its valid I'd like to
send the user on (along with the info they've entered) to an external
site to process payment.

Thanks,
Dave
Steve Klabnik | 29 Jun 21:44 2011

Re: sending a post request from a controller

If you're sending them along, isn't that a redirect, not a POST?

_______________________________________________
Camping-list mailing list
Camping-list@...
http://rubyforge.org/mailman/listinfo/camping-list
David Susco | 29 Jun 22:43 2011
Picon

Re: sending a post request from a controller

Can I send POST data along with a redirect?

Dave

On Wed, Jun 29, 2011 at 3:44 PM, Steve Klabnik <steve@...> wrote:
> If you're sending them along, isn't that a redirect, not a POST?
> _______________________________________________
> Camping-list mailing list
> Camping-list@...
> http://rubyforge.org/mailman/listinfo/camping-list
>

--

-- 
Dave
Steve Klabnik | 29 Jun 23:00 2011

Re: sending a post request from a controller

No, redirects are an HTTP response, they're not a new request.


Can you give a more concrete example? Your explanation sounds like you're trying to do two different things, and I'm not sure which you mean.
_______________________________________________
Camping-list mailing list
Camping-list@...
http://rubyforge.org/mailman/listinfo/camping-list
Jenna Fox | 30 Jun 02:34 2011

Re: sending a post request from a controller

To illuminate the difference:

User goes to website, webserver asks camping "What should I tell this guy?"

camping goes to other website using Net::HTTP, talks to other website a bit, then hangs up and goes back to
the web server who asked that question and says...?

If you want the user to send a post request to another page, that's a bit tricky. Probably the best way to do it
is to send them back a <form> with some <input type=hidden name=thing value=blah> type elements in it,
then a little <script> which says:

<script> document.forms[0].submit(); </script>

at the end of the page. You should probably also include a submit button in the form for people with
javascript turned off.

On 30/06/2011, at 4:46 AM, David Susco wrote:

> What's the cleanest way to do this? With Net::HTTP? I have a form
> that's sent to a controller and validated. If its valid I'd like to
> send the user on (along with the info they've entered) to an external
> site to process payment.
> 
> Thanks,
> Dave
> _______________________________________________
> Camping-list mailing list
> Camping-list@...
> http://rubyforge.org/mailman/listinfo/camping-list
David Susco | 30 Jun 15:48 2011
Picon

Re: sending a post request from a controller

Ideally I'd like a user to be able to submit a form to the camping
app, having camping do all the validation and some preprocessing and
then have the camping app send the user to an external site (with the
post data) where the user can complete a payment.

Dave

On Wed, Jun 29, 2011 at 5:00 PM, Steve Klabnik <steve@...> wrote:
> No, redirects are an HTTP response, they're not a new request.
> Can you give a more concrete example? Your explanation sounds like you're
> trying to do two different things, and I'm not sure which you mean.
> _______________________________________________
> Camping-list mailing list
> Camping-list@...
> http://rubyforge.org/mailman/listinfo/camping-list
>

--

-- 
Dave

Gmane