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.

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

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 Stewart

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: