國內短信接口權威運營服務商網    電信全網移動信息服務許可證:B2-20150469

7x24小時服務熱線:

400-113-0919

java接口示例

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class SMSTest {

private static final String addr = "http://api.sms.cn/sms/";
private static final String userId = "用戶名";

/*
* 如uid是:test,登錄密碼是:123123
pwd=md5(123123test),即
pwd=b9887c5ebb23ebb294acab183ecf0769

*/
private static final String pwd = "MD5加密";

private static final String encode = "utf8";

public static void send(String msgContent, String mobile) throws Exception {

//組建請求
String straddr = addr +
"?ac=send&uid="+userId+
"&pwd="+pwd+
"&mobile="+mobile+
"&encode="+encode+
"&content=" + msgContent;

StringBuffer sb = new StringBuffer(straddr);
System.out.println("URL:"+sb);

//發送請求
URL url = new URL(sb.toString());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
BufferedReader in = new BufferedReader(new InputStreamReader(
url.openStream()));

//返回結果
String inputline = in.readLine();
System.out.println("Response:"+inputline);

}


public static void main(String[] args) {
try {
send("內容", "手機號");
} catch (Exception e) {
e.printStackTrace();
}
}



}

 

 

JAVA短信接口示例
\
宁夏11选5开奖分布走势图 上海快三开奖结果 河北11选5前三直遗漏 长城汽车股票 云南十一选五近一百期 白小姐开奖视频 福利彩票北京pk拾官网 北京股票配资公司 排列五预测大师 精彩时时彩软件官网 山东快乐扑克3开奖表