# How do you POST to another website?

**URL:** <https://www.ruby-forum.com/t/how-do-you-post-to-another-website/71553>\
**Category:** Rails\
**Created:** [October 9, 2006, 9:42pm UTC](https://www.ruby-forum.com/t/how-do-you-post-to-another-website/71553 "2006-10-09T21:42:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stever](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@Stever](https://www.ruby-forum.com/u/Stever)\
**Post date:** [October 9, 2006, 9:42pm UTC](https://www.ruby-forum.com/t/how-do-you-post-to-another-website/71553/1 "2006-10-09T21:42:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Stever](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@Stever](https://www.ruby-forum.com/u/Stever)\
**Post date:** [October 9, 2006, 9:56pm UTC](https://www.ruby-forum.com/t/how-do-you-post-to-another-website/71553/2 "2006-10-09T21:56:44Z")

</div>

http = Net::HTTP.new(‘[www.paypal.com](http://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.

---

<div class="post-metadata">

**Author:** ![Stever](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@Stever](https://www.ruby-forum.com/u/Stever)\
**Post date:** [October 10, 2006, 10:26am UTC](https://www.ruby-forum.com/t/how-do-you-post-to-another-website/71553/3 "2006-10-10T10:26:04Z")

</div>

> 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/](http://groups.google.com/group/ruby-talk-google/browse_thread/thread/)  
c712d0b123c61274

Regards,  
Andy S.

---

<div class="post-metadata">

**Author:** ![Stever](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@Stever](https://www.ruby-forum.com/u/Stever)\
**Post date:** [October 10, 2006, 5:19am UTC](https://www.ruby-forum.com/t/how-do-you-post-to-another-website/71553/4 "2006-10-10T05:19:30Z")

</div>

On 10/10/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> http = Net::HTTP.new(‘[www.paypal.com](http://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.

---

<div class="post-metadata">

**Author:** ![Stever](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@Stever](https://www.ruby-forum.com/u/Stever)\
**Post date:** [October 10, 2006, 1:56pm UTC](https://www.ruby-forum.com/t/how-do-you-post-to-another-website/71553/5 "2006-10-10T13:56:34Z")

</div>

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](http://www.agilewebdevelopment.com/rails-ecommerce)

🙂
