SDK下载地址(需要先登录阿里大于):https://www.alidayu.com/center/application/sdk
阿里大于文档中心(接入、返回码等文档):https://doc.alidayu.com/doc2/detail.htm?treeId=135&articleId=104495&docType=1
package com.FangBianMian.utils;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;
public class AlidayuSMS {
public static void main(String[] args) {
//官网的URL, http请求就用这个链接
String url = "http://gw.api.taobao.com/router/rest";
//成为开发者,创建应用后系统自动生成
String appkey = "xxxx";
String secret = "xxxxxxxxxxxx";
//短信内容,请参照阿里大于文档中心的 接入指南 -》应用开发
String json = JsonUtil.toJson(new AlidayuSMSBean());
TaobaoClient client=new DefaultTaobaoClient(url,appkey,secret);
AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
req.setExtend("123456"); //可选, 用于标识用户
req.setSmsType("normal"); //默认使用 normal
req.setSmsFreeSignName("xxxx"); //短信签名
req.setSmsParam(json); //短信内容
req.setSmsTemplateCode("SMS_xxxxxx"); //短信模板ID
req.setRecNum("183xxxxxxxx");//手机号码,如果是多个手机号码可以用逗号隔开
try{
AlibabaAliqinFcSmsNumSendResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
}catch(Exception e){
System.out.println("连接失败");
}
}
}