Net::HTTP – SSL/HTTPS request

On August 16, 2010, in IT Related, Ruby on Rails, by admin
require "net/https"
require "uri"

uri = URI.parse("https://secure.com/yourfile")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
response.body
That's it! you can now read the file and parse.
Thanks to RubyInside.com
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>