Tuesday 15 May 2012

ruby on rails - net/http and posting data to Google Checkout -


I am trying to post the form data to Google Checkout using the following code:

  X = Net :: HTTP.post_form (URI.parse ('https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/ [merchant_number_ here]'), @presse)  

When I try to use this line, I get the following error:

Make Payments Controller in Errno :: ECONNRESET

/ P>

Any thoughts on what could be wrong?

method post_form attempts to connect to Yuri on HTTPS, HTTPS should clearly tell you Net / HT that a secure connection should be used. You should do the following script. You can use the set_debug_output method to debug feedback from Google.

  is required 'pure / http' required 'net / https' url = URI.parse (' http: //checkout.google.com/api/checkout/v2 / CheckoutForm / Merchant / 1234567890 ') req = Net :: HTTP :: Post.new (url.path) req.set_form_data ({' my '=>' Params'}) res = Net :: HTTP.new ( Url.host, url.port) res.use_ssl = true # response to stderr for rib res.set_debug_output $ stderr res.start {| Http | Http.request (req)}  

No comments:

Post a Comment