ruby - HTTP request to send sms from rails app -
i'm writing sms sending function doesn't seem send sms.
idea sight of code why?
def self.send_sms(to, from, message) username = "uname" password = "pword" id = rand(36**8).to_s(36) dlr_url = uri::escape('http://www.skylinesms.com/messages/delivery?id=#{id}&type=%d') send_url = 'http://localhost:13013/cgi-bin/sendsms?username=#{username}&password=#{password}&to=#{to}&from=#{from}&text=#{message}&dlr-url=#{dlr_url}&dlr-mask=3' url = uri.parse(uri.encode(send_url)) req = net::http::get.new(url.to_s) res = net::http.start(url.host, url.port) {|http| http.request(req) } return res.body end
i'm not sure think so
def self.send_sms(to, from, message) ..... net::http.start(url.host, url.port) { |http| http.get(req.request_uri).body } end
Comments
Post a Comment