Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Posting to PayPal with Net::HTTPS
ddjolley
3/26/2009 1:42:00 AM
Hi,
I'm trying to post to PayPal using Net::HTTPS. I found the following
script on Google which I modified slightly:
require 'net/https'
require 'uri'
params={'cmd'=>'_xclick','notify_url'=>'
http://www.4test.net/cgi-bin/ipn_notify.cgi','business'=>'bus@host17.net','item_name'=>...
- Understanding
Widgets','item_number'=>'1','amount'=>'1.00','return'=>'
http://www.mydomain.net/test/dp/success....
}
url = URI.parse('
http://www.sandbox.paypal.com/cgi-bin/w...
)
req = Net::HTTP::Post.new(url.path)
# req.basic_auth 'jack', 'pass'
req.set_form_data(params, ';')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
res = http.start {|http| http.request(req) }
case res
when Net::HTTPSuccess, Net::HTTPRedirection
# OK
else
res.error!
end
puts(res)
It seems to be behaving much better than any of my prior attempts; but,
still doesn't work. I get:
warning: peer certificate won't be verified in this SSL session
/usr/lib/ruby/1.8/net/http.rb:586:in `connect': OpenSSL::SSL::SSLError
from /usr/lib/ruby/1.8/net/http.rb:586:in `connect'
from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
from /usr/lib/ruby/1.8/net/http.rb:542:in `start'
from ./test3.cgi:15
Can anyone suggest what I might do to tame this beast?
Thanks for any input.
... doug
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Posting to PayPal with Net::HTTPS
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password