Reputation: 2833
Im working on a small project which I need to send a couple of parameters to another server which has a web service for sending of SMS messages. I'm constructing the URL by calling a method on my controller like so,
...
send_sms(number,message)
sms_url = "http://sms-machine.xx.xx/sendsms/" + number + "/" + message
#go to the url above
end
The resulting page will be a delivery message from the server with either a "NO" or "YES" to show if the message was sent. It is important for the users to know if the sms message was sent or not. So my question is how do I visit the sms url. Is there such a go_to_url function in rails?
Upvotes: 0
Views: 178
Reputation: 104120
You can use the standard net/http
library to make your own HTTP requests: http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
Upvotes: 0
Reputation:
You can use Ruby's Net::HTTP or the much simpler open-uri functionality, eg:
require 'open-uri'
status = open("http://sms-machine.xx.xx/sendsms/#{number}/#{message}").read
Net:HTTP is loaded by default.
Upvotes: 3