"Ruby" International SMS API Interface Demo

Source: Internet
Author: User

Note: The following code is only for the convenience of customer testing and provide the sample code, the customer can according to their own needs to write the code for Learning and research interface only for use, but provides a reference

Require ' net/http '
Require ' URI '
Require ' JSON '

params = {
"Account" = "",
"Password" = "a.123456",

Mobile phone number, format (area code + mobile number), for example: 8615800000000, of which 86 is China's area code
"mobile" => "8615800000000",   

}.to_json

def send_data (Url,data)
url = uri.parse (URL)
req = net::http::P ost.new (url.path,{' content-type ' = ' Application/json '})
Req.body = Data
res = net::http.new (url.host,url.port). start{|http| http.request (req)}

puts res.body                                                                                                  

End

Send_data (' Http://intapi.253.com/send/json ', params)

"Ruby" International SMS API Interface Demo

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.