Ruby Sample Code (GET)
require "rubygems"
require "net/https"
require "uri"
require "json"
apikey = "yourapiKey"
numbers = "9233312345678,9232112345678,923451234567"
message = "This is your message"
sender = "SmartSMS"
requested_url = 'http://www.hajanaone.com/api/sendsms.php?' + "apikey=" + apikey + "&phone=" + phone + "&message=" + URI.escape(message) + "&sender=" + sender
uri = URI.parse(requested_url)
http = Net::HTTP.start(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
res = http.request(request)
response = JSON.parse(res.body)
puts (response)
Ruby Sample Code (POST)
require "rubygems"
require "net/https"
require "uri"
require "json"
requested_url = 'http://www.hajanaone.com/api/sendsms.php?'
uri = URI.parse(requested_url)
http = Net::HTTP.start(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
res = Net::HTTP.post_form(uri, 'apikey' => 'yourApikey', 'message' => 'This is your message', 'sender' => 'SmartSMS', 'phone' => '923331234567,923001234567,923451234567')
response = JSON.parse(res.body)
puts (response)