How do you POST to another website?

I am integrating my rails website with paypal. It seems that paypal
wants me to make a POST to their website with the shopping cart
details. This won’t work:
post :website_name, :variables => {:varA => "blah, :varB => “blah”}

I checked around google, but having trouble finding this one. Do I have
to use “Net::HTTP” or something?

  • Steve

http = Net::HTTP.new(‘www.paypal.com
headers, response = http.post(post_page, post_parans)
puts response

You can also pass a hash of headers to the post/get methods.

I am integrating my rails website with paypal. It seems that paypal
wants me to make a POST to their website with the shopping cart
details. This won’t work:
post :website_name, :variables => {:varA => "blah, :varB => “blah”}

I checked around google, but having trouble finding this one. Do I
have
to use “Net::HTTP” or something?

You may find yesterday’s thread entitled ‘Posting over https’ on Ruby
Talk helpful.

http://groups.google.com/group/ruby-talk-google/browse_thread/thread/
c712d0b123c61274

Regards,
Andy S.

On 10/10/06, [email protected] [email protected] wrote:

http = Net::HTTP.new(‘www.paypal.com
headers, response = http.post(post_page, post_parans)
puts response

You can also pass a hash of headers to the post/get methods.

What i normally do in that case, is create a hidden form, populate the
params parameter and post it to other website. Works great.


There was only one Road; that it was like a great river: its springs
were at every doorstep, and every path was its tributary.

On Oct 9, 2006, at 8:16 PM, hemant wrote:

params parameter and post it to other website. Works great.

This method works very well. I use it, and it’s described in my
Rails e-commerce book:

http://www.agilewebdevelopment.com/rails-ecommerce

:slight_smile: