package com.tjk.sms;

import java.io.UnsupportedEncodingException;


public class SmsSender {
	private static String strReg = "101100-WEB-HUAX-544548";
	private static String strPwd = "EJJXMMDM";
	private static String strSourceAdd = "";
	/*
	 * 发送验证码类的短信接口
	 * 返回0为发送成功，其它值为失败
	 * @param
	 * */
	public static int snedValidcodeSms(String strPhone, String content) {
		String strContent = "";
		try {
			strContent = SmsHttpAPI.paraTo16(content);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			return 1;
		}
		String strSmsUrl = "http://www.stongnet.com/sdkhttp/sendsms.aspx";
		String strSmsParam = "reg=" + strReg + "&pwd=" + strPwd + "&sourceadd=" + strSourceAdd + "&phone=" + strPhone + "&content=" + strContent;
		String strRes = SmsHttpAPI.postSend(strSmsUrl, strSmsParam);
		if (strRes.indexOf("result=0") != -1) {//成功返回0
			return 0;
		} else {
			return 1;
		}
	}
}
