Demo代码下载
Java代码示例
在线技术支持
package com.ruanwei.interfacej;
import com.ruanwei.tool.SmsClientOverage;
import com.ruanwei.tool.SmsClientKeyword;
import com.ruanwei.tool.SmsClientSend;
import com.ruanwei.tool.SmsClientQueryStatusReport;
import com.ruanwei.tool.SmsClientQueryCall;
import com.ruanwei.tool.SmsClientAccessTool;
public class Test {
public static String baseUrl= "http://domian:port";
public static String smsUrl = baseUrl+"/sms.aspx?dataType=json";
public static String statusApiUrl = baseUrl+"/statusApi.aspx?dataType=json";
public static String callApiUrl = baseUrl+"/callApi.aspx?dataType=json";
public static String userid = "您的用户id";
public static String account = "您的账户名";
public static String password = "您的密码";
public static String mobile = "11位手机号1,11位手机号2,11位手机号3";
public static String content = "【签名】这里是短信的内容";
public static void main(String[] args) {
//查询余额
//queryOverage();
//查询屏蔽词
//queryKeyWord(content);
//发送短信
sendSms(mobile,content);
//查询状态报告
//queryStatusReport();
//查询回复
//queryCall();
}
public static void queryOverage() {
String res = SmsClientOverage.queryOverage(smsUrl, userid, account,
password);
System.out.println(res);
}
public static void queryKeyWord(String content) {
String res = SmsClientKeyword.queryKeyWord(smsUrl, userid, account,
password, content);
System.out.println(res);
}
public static void sendSms(String mobile,String content) {
String res = SmsClientSend.sendSms(smsUrl, userid, account,password,mobile, content);
System.out.println(res);
}
public static void queryStatusReport() {
String res = SmsClientQueryStatusReport.queryStatusReport(statusApiUrl, userid, account,password);
System.out.println(res);
}
public static void queryCall() {
String res = SmsClientQueryCall.queryCall(callApiUrl, userid, account,password);
System.out.println(res);
}
//自定义请求
public static void test(String params) {
String send = SmsClientAccessTool.getInstance().doAccessHTTPPost(
smsUrl, params);
System.out.println(send);
}
}