What is the right syntax for Ruby to do a system call to curl?
There are many ways
REFRESH_DRADIS_URL = "https://redmineserver+webappkey"result = `/usr/bin/curl --insecure #{REFRESH_DRADIS_URL}`
but I don't think you have to use curl at all. Try this
require 'open-uri'open(REFRESH_DRADIS_URL)
If the certificate isn't valid then it gets a little more complicated
require 'net/https'http = Net::HTTP.new("amazon.com", 443)http.use_ssl = truehttp.verify_mode = OpenSSL::SSL::VERIFY_NONEresp, data = http.get("/")
For such a simple problem, I wouldn't bother with shelling out to curl
, I'd simply do
require 'net/https'http = Net::HTTP.new('redmineserver+webappkey', 443)http.use_ssl = truehttp.verify_mode = OpenSSL::SSL::VERIFY_NONEhttp.get('/')
And for more complex problems, I'd still not shell out to curl
, but rather use one of the many Ruby libcurl
bindings.