<fieldset id="eo0ma"></fieldset>
  • 請求地址
    名稱是否必須示例值說明
    請求地址UTF-8http://dc.28inter.com/sms.aspx

    如果服務(wù)器不支持解析,

    請聯(lián)系技術(shù)人員進(jìn)行協(xié)助處理!

    請求參數(shù)
    名稱是否必須示例值描述
    發(fā)送任務(wù)命令必須固定設(shè)置為:send設(shè)置為固定的:send
    帳戶                必須28inter注冊或系統(tǒng)管理員分配獲取,登陸賬號
    密碼    必須123456    注冊或系統(tǒng)管理員分配獲取,登陸密碼
    用戶ID    必須1001   注冊或系統(tǒng)管理員分配獲取,賬戶ID
    發(fā)送號碼必須13000000000,13000000001短信接收號碼。支持單個或多個手機號碼,傳入號碼為11位手機號碼,不能加0或86。群發(fā)短信需傳入多個號碼,以英文逗號分隔,一次調(diào)用最多傳入200個號碼示例:13000000000,13000000001
    發(fā)送內(nèi)容必須【創(chuàng)信信息】您的驗證碼是:123456

    發(fā)送短信的內(nèi)容,整體做用urlencode。短信的格式為:【簽名】放在內(nèi)容的最前方。
    示范:【創(chuàng)信信息】您本次注冊的驗證碼是:888888,
    其中簽名可根據(jù)自己公司的名稱或簡稱自定義,字?jǐn)?shù)為2-8字,不可以是純數(shù)字,電話號碼或者網(wǎng)址,不可以是無意義的簽名,比如【大家好】;【哈哈哈】;【提示】;【測試】等
    正確示例:【創(chuàng)信信息】,【京東】,【百度】,【工商銀行】
    錯誤示例:【你好】,【通知】,【測試一下】,【哈哈哈】,【123123】

    sendtime可選2000-12-31 00:00:10短信定時發(fā)送時間。不設(shè)置默認(rèn)為立即發(fā)送。格式為:YYYY-MM-DD HH:MM:SS
    rt可選json固定值 json,不填則為XML格式返回

     

    JAVA實例

    公共類SmsClientSend { 
    / * 
    * @param url 
    *:必填 - 發(fā)送連接地址URL - http://dc.28inter.com/sms.aspx 
    * @param userid 
    *:必填 - 用戶ID,為數(shù)字
    * @param account 
    *:必填 - 用戶帳號
    * @param密碼
    *:必填 - 用戶密碼
    * @param mobile 
    *:必填 - 發(fā)送的手機號碼,多個可以用逗逗隔比如> 130xxxxxxxx ,131xxxxxxxx 
    * @param content 
    *:必填 - 實際發(fā)送內(nèi)容,
    * @param action 
    *:選填 - 訪問的事件,默認(rèn)為send 
    * @param sendType 
    *:選填 - 發(fā)送方式,默認(rèn)為POST 
    * @param codingType 
    *:選填 - 發(fā)送內(nèi)容編碼方式,默認(rèn)為UTF-8 
    * @param backEncodType 
    *:選填 - 返回內(nèi)容編碼方式,默認(rèn)為UTF-8 
    * @return返回發(fā)送之后收到的信息
    * / 
    private static String sendSms(String url,String userid,String account,
    String password,String mobile,String content,String action,
    String sendType,String codingType,String backEncodType){

    try { 
    if(codingType == null || codingType.equals("")){ 
    codingType ="UTF-8"

    如果(backEncodType == NULL || backEncodType.equals( "")){ 
    backEncodType = "UTF-8"
    StringBuffer send = new StringBuffer(); 
    if(action!= null &&!action.equals( "")){ 
    send.append("action =")。append(action); 
    } else { 
    send.append("action = send"); 
    }

    send.append( "&用戶id =")附加(用戶ID)。
    send.append("&account =")。append(
    URLEncoder.encode(account,codingType)); 
    send.append("&password =")。append(
    URLEncoder.encode(password,codingType)); 
    send.append("mobile ="),append ;

    send.append("&content ="),append ;

    URLEncoder.encode(content,codingType)); 
    if(sendType!= null &&(sendType.toLowerCase())。equals("get")){ 
    return SmsClientAccessTool.getInstance()。doAccessHTTPGet(
    url +&ldquo;?&rdquo;+ send.toString(),backEncodType); 
    } else { 
    return SmsClientAccessTool.getInstance()。doAccessHTTPPost(url,
    send.toString(),backEncodType); 

    }(例外){ 
    e.printStackTrace(); 
    return&ldquo;未發(fā)送,編碼異常&rdquo;

    }


    公共類SmsClientAccessTool {

    private static SmsClientAccessTool smsClientToolInstance;

    / ** 
    *采用單列方式來訪問操作

    * @return 
    * / 
    public static synchronized SmsClientAccessTool getInstance(){

    if(smsClientToolInstance == null){ 
    smsClientToolInstance = new SmsClientAccessTool(); 

    return smsClientToolInstance; 
    }

    / ** 
    *

    * POST方法
    *


    * @param sendUrl 
    *:訪問URL 
    * @param paramStr 
    *:參數(shù)串
    * @param backEncodType 
    *:返回的編碼
    * @return 
    * / 
    public String doAccessHTTPPost(String sendUrl,String sendParam,
    String backEncodType){

    StringBuffer receive = new StringBuffer(); 
    BufferedWriter wr = null; 
    try { 
    if(backEncodType == null || backEncodType.equals("")){ 
    backEncodType ="UTF-8" 
    }

    URL url =新網(wǎng)址(sendUrl); 
    HttpURLConnection URLConn =(HttpURLConnection)url 
    .openConnection();

    URLConn.setDoOutput(真); 
    URLConn.setDoInput(真); 
    ((HttpURLConnection)URLConn)。setRequestMethod("POST"); 
    URLConn.setUseCaches(假); 
    URLConn.setAllowUserInteraction(真); 
    HttpURLConnection.setFollowRedirects(真); 
    URLConn.setInstanceFollowRedirects(真);

    URLConn.setRequestProperty("Content-Type",
    &ldquo;application / x-www-form-urlencoded; charset = UTF-8); 
    URLConn.setRequestProperty("Content-Length",String 
    .valueOf(sendParam.getBytes()。length));

    DataOutputStream dos = new DataOutputStream(URLConn 
    .getOutputStream()); 
    dos.writeBytes(sendParam);

    BufferedReader rd = new BufferedReader(new InputStreamReader(
    URLConn.getInputStream(),backEncodType)); 
    字符串行; 
    while((line = rd.readLine())!= null){ 
    receive.append(line).append("\ r \ n"); 

    rd.close(); 
    } catch(java.io.IOException e){ 
    receive.append("訪問產(chǎn)生了異常 - >").append(e.getMessage()); 
    e.printStackTrace(); 
    } finally { 
    if(wr!= null){ 
    try { 
    wr.close(); 
    } catch(IOException ex){ 
    ex.printStackTrace(); 

    WR = NULL; 

    }

    return receive.toString(); 
    }

    public String doAccessHTTPGet(String sendUrl,String backEncodType){

    StringBuffer receive = new StringBuffer(); 
    BufferedReader in = null; 
    try { 
    if(backEncodType == null || backEncodType.equals("")){ 
    backEncodType ="UTF-8" 
    }

    URL url =新網(wǎng)址(sendUrl); 
    HttpURLConnection URLConn =(HttpURLConnection)url 
    .openConnection();

    URLConn.setDoInput(真); 
    URLConn.setDoOutput(真); 
    URLConn.connect(); 
    URLConn.getOutputStream()平齊(); 
    in = new BufferedReader(new InputStreamReader(URLConn 
    .getInputStream(),backEncodType));

    字符串行; 
    while((line = in.readLine())!= null){ 
    receive.append(line).append("\ r \ n"); 
    }

    } catch(IOException e){ 
    receive.append("訪問產(chǎn)生了異常 - >")。append(e.getMessage()); 
    e.printStackTrace(); 
    } finally { 
    if(in!= null){ 
    try { 
    in.close(); 
    } catch(java.io.IOException ex){ 
    ex.printStackTrace(); 

    in = null;


    }

    return receive.toString(); 

    }

    微信

    公眾號