阿里大于 DEMO(java)


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("连接失败");
}
}
}

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值