Chinaunix首页 | 论坛 | 博客
  • 博客访问: 39993
  • 博文数量: 19
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 205
  • 用 户 组: 普通用户
  • 注册时间: 2018-01-23 15:20
文章分类

全部博文(19)

文章存档

2018年(19)

我的朋友

分类: Python/Ruby

2018-06-29 10:05:09

# 说明:
# 以下代码只是为了方便客户测试而提供的示例代码,客户可以根据自己的需要另行编写
# 该代码仅供学习和研究接口使用,只是提供了一个参考

require 'net/http'  
require 'uri'  
require 'json'  

params = {  
    "account" => "",  
    "password" => "a.123456",  
    # 手机号码,格式(区号+手机号码),例如:8615800000000,其中86为中国的区号
    "mobile" => "8615800000000",   
    "msg" =>URI::escape("【253云通讯】您好,您的验证码是999999") 
}.to_json  

def send_data(url,data)  
    url = URI.parse(url)  
    req = Net::HTTP::Post.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('',params)

阅读(3283) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~