Ich versuche auf Dreamhost API zugreifen, um eine E-Mail zu senden.Erstellen komplexer URL
Die API erwartet eine URL-Domains und die tatsächliche emailcontent
enthältdomain = '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 # } }
Wenn ich analysiere die URL Ich erhalte einen Fehler
schlecht URI (nicht URI?)
Die URL enthält die URL selbst aus dem Listennamen und der Nachricht und ich nehme an, dies verursacht das Problem. Ich habe keine Ahnung, wie ich das angehen soll. CGI escpae wurde vorgeschlagen, aber das scheint weißen Raum in + zu konvertieren.
Jemand weiß, wie man das löst?
Dank