Hi Railers, I''m working on some integration with a payment gateway, and need to generate some XML, log in to the remote site (standard authentication) over HTTPS and post the XML to a specific URL. I''ve got my XML generating OK (as an .rxml file in my views), but now need to grab that into a buffer and post it to the URL. I imagine some code similar to the stuff on this page would do the posting: http://www.bigbold.com/snippets/posts/show/788 Just wondered if anyone had some Rails specific examples of how to generate a page into a buffer, then send it as a post request to a URL? I surely can''t be the first one to need to do this? Thanks for any pointers, much appreciated! Cheers, ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
On 10/31/05, Dave Silvester <dave-AJqNGCqIqVQ7cdpDWioORw@public.gmane.org> wrote:> > Hi Railers, > > I''m working on some integration with a payment gateway, and need to > generate > some XML, log in to the remote site (standard authentication) over HTTPS > and > post the XML to a specific URL. > > I''ve got my XML generating OK (as an .rxml file in my views), but now need > to > grab that into a buffer and post it to the URL. > > I imagine some code similar to the stuff on this page would do the > posting: > > http://www.bigbold.com/snippets/posts/show/788 > > Just wondered if anyone had some Rails specific examples of how to > generate a > page into a buffer, then send it as a post request to a URL? I surely > can''t > be the first one to need to do this? > > Thanks for any pointers, much appreciated! >require ''net/https'' site = Net::HTTP.new( ''test.com <http://test.com>'', 443 ) site.use_ssl = true response = site.post(''transact'', query) puts response.body _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Dave - you may want to look at adding an extension to Lucas Carlson''s payment gateway library: http://payment.rufy.com (which appears to be down at the moment) Cheers, -David Felstead On 11/1/05, Dave Silvester <dave-AJqNGCqIqVQ7cdpDWioORw@public.gmane.org> wrote:> Hi Railers, > > I''m working on some integration with a payment gateway, and need to generate > some XML, log in to the remote site (standard authentication) over HTTPS and > post the XML to a specific URL. > > I''ve got my XML generating OK (as an .rxml file in my views), but now need to > grab that into a buffer and post it to the URL. > > I imagine some code similar to the stuff on this page would do the posting: > > http://www.bigbold.com/snippets/posts/show/788 > > Just wondered if anyone had some Rails specific examples of how to generate a > page into a buffer, then send it as a post request to a URL? I surely can''t > be the first one to need to do this? > > Thanks for any pointers, much appreciated! > > Cheers, > > ~Dave > > -- > > Dave Silvester > Rent-A-Monkey Website Development > Web: http://www.rentamonkey.com/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Monday 31 Oct 2005 21:45, snacktime wrote:> require ''net/https'' > site = Net::HTTP.new( ''test.com <http://test.com>'', 443 ) > site.use_ssl = true > response = site.post(''transact'', query) > puts response.bodyNice example, almost exactly what I needed, thanks very much! :-D ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/