0
我试图访问Dreamhost API来发送邮件。创建复杂的网址
的API预计含有域的地址与实际emailcontent
domain = 'https://api.dreamhost.com/' key = "dq86ds5qd4sq" command = "announcement_list-post_announcement" mailing = "mailing" domain = "domain.nl" listname = "mailing Adventure"<[email protected]>" message = '<html>html here</html>' url = domain + "&key=#{key}&cmd=#{command}&listname=#{mailing}&domain=#{domain}&listname=#{listname}&message=#{message}" uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == "https" # enable SSL/TLS http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.start { # http.request_get(uri.path) {|res| # print res.body # } }
当我解析URL,我得到一个错误
坏URI(是不是URI?)
url包含来自listname和message的url本身我认为这会导致问题。我不知道如何去赞美这件事。 CGI escpae已被提出,但似乎将空白转换为+。
有人知道如何解决这个问题吗?
感谢