Ssl encryption with post_form()

im writing a program that needs to post a form, and iv found that i can
do this with post_form(), but i need to send it over a connection with
ssl encryption. heres my code

require ‘net/http’
require ‘uri’
res = Net::HTTP.post_form(URI.parse(‘http://the/url’),
{
‘my test’ => ‘variables’
}
)
puts res.body

and that works, but without ssl. i wanted somthing like this

require ‘net/http’
require ‘uri’
res = Net::HTTP.post_form(URI.parse(‘http://the/url’),
{
‘my test’ => ‘variables’
}
)
res.ssl = true
puts res.body

but i havnt found anything. hope i have been clear

On Fri, Nov 5, 2010 at 8:19 AM, Robbie M. [email protected]
wrote:

im writing a program that needs to post a form, and iv found that i can
do this with post_form(), but i need to send it over a connection with
ssl encryption. heres my code

but i havnt found anything. hope i have been clear

Did you try googling for “ruby https post”? The first few results will
have some answers.

Regards,
Ammar

Ammar A. wrote in post #959518:

On Fri, Nov 5, 2010 at 8:19 AM, Robbie M. [email protected]
wrote:

im writing a program that needs to post a form, and iv found that i can
do this with post_form(), but i need to send it over a connection with
ssl encryption. heres my code

but i havnt found anything. hope i have been clear

Did you try googling for “ruby https post”? The first few results will
have some answers.

Regards,
Ammar

hee, thanks, i didnt think to google it

i already tried that, didnt help

On Fri, Nov 5, 2010 at 10:58 PM, Robbie M. [email protected]
wrote:

hee, thanks, i didnt think to google it

i already tried that, didnt help

.facetiousness
%strong Maybe your google is broken?!

Without quotes, I get this as the first result:

http://snippets.dzone.com/posts/show/788

With quotes, I get this as the first result:

http://javazquez.com/juan/2008/12/07/ruby-https-posting/

Note how both include things like:

require ‘net/https’

and

http = Net::HTTP.new(‘host.tld’, 443)
http.use_ssl = true

Regards,
Ammar

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs