From dsusco at gmail.com Wed Jun 29 14:46:59 2011 From: dsusco at gmail.com (David Susco) Date: Wed, 29 Jun 2011 14:46:59 -0400 Subject: sending a post request from a controller Message-ID: 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 From steve at steveklabnik.com Wed Jun 29 15:44:14 2011 From: steve at steveklabnik.com (Steve Klabnik) Date: Wed, 29 Jun 2011 15:44:14 -0400 Subject: sending a post request from a controller In-Reply-To: References: Message-ID: If you're sending them along, isn't that a redirect, not a POST? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dsusco at gmail.com Wed Jun 29 16:43:01 2011 From: dsusco at gmail.com (David Susco) Date: Wed, 29 Jun 2011 16:43:01 -0400 Subject: sending a post request from a controller In-Reply-To: References: Message-ID: Can I send POST data along with a redirect? Dave On Wed, Jun 29, 2011 at 3:44 PM, Steve Klabnik wrote: > If you're sending them along, isn't that a redirect, not a POST? > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -- Dave From steve at steveklabnik.com Wed Jun 29 17:00:23 2011 From: steve at steveklabnik.com (Steve Klabnik) Date: Wed, 29 Jun 2011 17:00:23 -0400 Subject: sending a post request from a controller In-Reply-To: References: Message-ID: 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From a at creativepony.com Wed Jun 29 20:34:12 2011 From: a at creativepony.com (Jenna Fox) Date: Thu, 30 Jun 2011 10:34:12 +1000 Subject: sending a post request from a controller In-Reply-To: References: Message-ID: <21818443-2AF6-4B96-9B52-05F93DD6F1D3@creativepony.com> 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
with some type elements in it, then a little 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 at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list From dsusco at gmail.com Thu Jun 30 09:48:22 2011 From: dsusco at gmail.com (David Susco) Date: Thu, 30 Jun 2011 09:48:22 -0400 Subject: sending a post request from a controller In-Reply-To: References: Message-ID: 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 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 at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > -- Dave