Docy

Did You Know?

Ruby Sample Code (GET)

                                        

                                    require "rubygems"
                                    require "net/https"
                                    require "uri"
                                    require "json"
                                    
                                    apikey = "yourapiKey"
                                    numbers = "923186373741,923186373741,923186373741"
                                    message = "This is your message"
                                    sender = "SmartSMS"
                                    
                                    requested_url = 'http://www.echosofts.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.echosofts.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,923186373741')
                                    response = JSON.parse(res.body)
                                    puts (response)
                                    
                                    
                                         
                                    
CONTENTS