• <var id="a0tii"><output id="a0tii"><rt id="a0tii"></rt></output></var>
    1. <var id="a0tii"></var>

    2. <sub id="a0tii"></sub>

        <var id="a0tii"><output id="a0tii"><ol id="a0tii"></ol></output></var>
        短信平臺服務熱線:400-114-8008
      1. 試用測試
      2. 開通產品
      3. 內容報備
      4. 接口對接
      5. 接入成功
      6. 會員通知短信
        using System;  
        using System.Collections.Generic;  
        using System.Linq;  
        using System.Text;  
        using System.Net.Security;  
        using System.Security.Cryptography.X509Certificates;  
        using System.Net;  
        using System.IO;  
        using System.IO.Compression;  
        using System.Text.RegularExpressions; 
        using System.Security.Cryptography;
        using System.Web;
        public class Test
        {
           private static readonly string DefaultUserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";  
          private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)  
            {  
              return true; //總是接受     
            }  
          static void Main(string[] args)  
              {  
                    DateTime dt = DateTime.Now; 
                    string mttime = dt.ToString("yyyyMMddHHmmss");
                    string pwd1 = "密碼"+mttime;//密碼
                    string pwd = md5(pwd1);
                     Console.WriteLine(pwd.Length);
                    string content = "【閱信】驗證碼888888,請注意保密,以防泄露!";
                    //string content = "123456"; 語音驗證碼內容
                    string url = " http://IP:Port/HttpSmsMt";//接口地址,請咨詢客服  
                    Encoding encoding = Encoding.GetEncoding("utf-8");  
                    IDictionary parameters = new Dictionary();  
                    parameters.Add("name", "用戶名");//開通的用戶名  
                    parameters.Add("pwd", pwd);  
                    parameters.Add("content",content);
                    parameters.Add("phone","13400000000");
                    parameters.Add("subid","");
                    parameters.Add("mttime", mttime);  
                    parameters.Add("rpttype", "1");  
                    HttpWebResponse response = CreatePostHttpResponse(url,parameters,encoding);  
                    //打印返回值  
                    Stream stream = response.GetResponseStream();   //獲取響應的字符串流  
                    StreamReader sr = new StreamReader(stream); //創建一個stream讀取流  
                    string html = sr.ReadToEnd();   //從頭讀到尾,放到字符串html  
                    Console.WriteLine(html);   
                }
            public static String md5(String s)
                {
                    MD5 md5 = new MD5CryptoServiceProvider();
                    byte[] bytes = System.Text.Encoding.UTF8.GetBytes(s);
                    bytes = md5.ComputeHash(bytes);
                    md5.Clear();
        
                    string ret = "";
                    for (int i = 0; i < bytes.Length; i++)
                    {
                        ret += Convert.ToString(bytes[i], 16).PadLeft(2, '0');
                    }
        
                    return ret.PadLeft(32, '0');
                }
             public static HttpWebResponse CreatePostHttpResponse(string url, IDictionary parameters,Encoding charset)  
                {  
                    HttpWebRequest request = null;  
                    //HTTPSQ請求  
                    ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);  
                    request = WebRequest.Create(url) as HttpWebRequest;  
                    request.ProtocolVersion = HttpVersion.Version10;  
                    request.Method = "POST";  
                    request.ContentType = "application/x-www-form-urlencoded";  
                    request.UserAgent = DefaultUserAgent;  
                    //如果需要POST數據     
                    if (!(parameters == null || parameters.Count == 0))  
                    {  
                        StringBuilder buffer = new StringBuilder();  
                        int i = 0;  
                        foreach (string key in parameters.Keys)  
                        {  
                            if (i > 0)  
                            {  
                               buffer.AppendFormat("&{0}={1}",key,parameters[key]);  
                            }  
                            else  
                            {  
                                buffer.AppendFormat("{0}={1}",key, parameters[key]);  
                            }  
                            i++;  
                        }  
                        byte[] data = charset.GetBytes(buffer.ToString());  
                        using (Stream stream = request.GetRequestStream())  
                        {  
                            stream.Write(data, 0, data.Length);  
                        }  
                    }  
                    return request.GetResponse() as HttpWebResponse;  
                } 
        }
        #!/usr/bin/env python
        #coding=utf-8
        import urllib
        import urllib2
        import time
        import hashlib
        
        def md5(str):
            import hashlib
            m = hashlib.md5()   
            m.update(str)
            return m.hexdigest()
            
        url = 'http://IP:Port/HttpSmsMt' #接口地址,請咨詢客服
        timenew= time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
        pwd = md5(密碼+timenew) #密碼
        values = {'name':用戶名,'pwd':pwd,'content':'【閱信】驗證碼888888。','phone':'13400000000','subid':'','mttime':timenew} #開通的用戶名
        # values = {'name':用戶名,'pwd':pwd,'content':'123456','phone':'13400000000','subid':'','mttime':timenew} 語音驗證碼內容
        data = urllib.urlencode(values)
        req = urllib2.Request(url, data)
        response = urllib2.urlopen(req)
        the_page = response.read()
        print the_page
        package main
        import (
        	"fmt"
        	"io/ioutil"
        	"net/http"
        	"net/url"
            "time"
            "strconv"  
            "strings"
            "crypto/md5"
            "encoding/hex"
        )
        func httpPostForm() {
            var time=Format(time.Now(), "yyyyMMddHHmmss");
            var password = "xxxxx";//密碼
            pwd := md5.New()
            pwd.Write([]byte(password+time)) // 需要將密碼和時間加密
            var content = "【閱信】驗證碼888888";
            //var content = "123456";  語音驗證碼內容
            var name = "xxxxx"http://賬號
        	resp, err := http.PostForm("http://IP:Port/HttpSmsMt",//接口地址,請咨詢客服
        		url.Values{"name": {name}, "pwd": {hex.EncodeToString(pwd.Sum(nil))},"content":{content},"phone":{"13400000000"},"subid":{""},"mttime":{time},"rpttype":{"1"}})
        	if err != nil {
        		// handle error
        	}
        	defer resp.Body.Close()
        	body, err := ioutil.ReadAll(resp.Body)
        	if err != nil {
        		// handle error
        	}
        	fmt.Println(string(body))
        }
        func byteString(p []byte) string {
                for i := 0; i < len(p); i++ {
                        if p[i] == 0 {
                                return string(p[0:i])
                        }
                }
                return string(p)
        }
        
        func Format(t time.Time, format string) string {  
            //year  
            if strings.ContainsAny(format, "y") {  
                year := strconv.Itoa(t.Year())  
                if strings.Count(format, "yy") == 1 && strings.Count(format, "y") == 2 {  
                    format = strings.Replace(format, "yy", year[2:], 1)  
                } else if strings.Count(format, "yyyy") == 1 && strings.Count(format, "y") == 4 {  
                    format = strings.Replace(format, "yyyy", year, 1)  
                } else {  
                    panic("format year error! please 'yyyy' or 'yy'")  
                }  
            }  
          
            //month  
            if strings.ContainsAny(format, "M") {  
                var month string  
                if int(t.Month()) < 10 {  
                    month = "0" + strconv.Itoa(int(t.Month()))  
                } else {  
                    month = strconv.Itoa(int(t.Month()))  
                }  
                if strings.Count(format, "MM") == 1 && strings.Count(format, "M") == 2 {  
                    format = strings.Replace(format, "MM", month, 1)  
                } else {  
                    panic("format month error! please 'MM'")  
                }  
            }  
            //day  
            if strings.ContainsAny(format, "d") {  
                var day string  
                if t.Day() < 10 {  
                    day = "0" + strconv.Itoa(t.Day())  
                } else {  
                    day = strconv.Itoa(t.Day())  
                }  
                if strings.Count(format, "dd") == 1 && strings.Count(format, "d") == 2 {  
                    format = strings.Replace(format, "dd", day, 1)  
                } else {  
                    panic("format day error! please 'dd'")  
                }  
            }  
          
            //hour  
            if strings.ContainsAny(format, "H") {  
                var hour string  
                if t.Hour() < 10 {  
                    hour = "0" + strconv.Itoa(t.Hour())  
                } else {  
                    hour = strconv.Itoa(t.Hour())  
                }  
                if strings.Count(format, "HH") == 1 && strings.Count(format, "H") == 2 {  
                    format = strings.Replace(format, "HH", hour, 1)  
                } else {  
                    panic("format hour error! please 'HH'")  
                }  
            }  
            //minute  
            if strings.ContainsAny(format, "m") {  
                var minute string  
                if t.Minute() < 10 {  
                    minute = "0" + strconv.Itoa(t.Minute())  
                } else {  
                    minute = strconv.Itoa(t.Minute())  
                }  
                if strings.Count(format, "mm") == 1 && strings.Count(format, "m") == 2 {  
                    format = strings.Replace(format, "mm", minute, 1)  
                } else {  
                    panic("format minute error! please 'mm'")  
                }  
            }  
          
            //second  
            if strings.ContainsAny(format, "s") {  
                var second string  
                if t.Second() < 10 {  
                    second = "0" + strconv.Itoa(t.Second())  
                } else {  
                    second = strconv.Itoa(t.Second())  
                }  
                if strings.Count(format, "ss") == 1 && strings.Count(format, "s") == 2 {  
                    format = strings.Replace(format, "ss", second, 1)  
                } else {  
                    panic("format second error! please 'ss'")  
                }  
            }  
            return format  
        } 
        
        func main() {
        httpPostForm()
        }
        public class Api {
        	public static void main(String[] args) {
        		// 接口地址
        		String url = "http://IP:Port/HttpSmsMt";//接口地址,請咨詢客服
        		// 下發時間
        		String mttime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
        		Map param = new HashMap();
        		param.put("name", "賬號");//開通的用戶名
        		param.put("pwd", Api.MD51("密碼" + mttime));//密碼
        		try {
        			param.put("content", URLEncoder.encode("【閱信】驗證碼888888。 ", "UTF-8"));
                   // param.put("content", "123456"); 語音驗證碼內容
        		} catch (UnsupportedEncodingException e) {
        			e.printStackTrace();
        		}
        		param.put("phone", "13400000000");
        		param.put("subid", "");
        		param.put("mttime", mttime);
               param.put("rpttype", "1");
        		sendPost(url, param);
        	}
        
        	public static String sendPost(String url, Map params) {
        		URL u = null;
        		HttpURLConnection con = null;
        		// 構建請求參數
        		StringBuffer sb = new StringBuffer();
        		if (params != null) {
        			for (Entry e : params.entrySet()) {
        				sb.append(e.getKey()).append("=").append(e.getValue()).append("&");
        			}
        			sb.substring(0, sb.length() - 1);
        		}
        		// 嘗試發送請求
        		try {
        			u = new URL(url);
        			con = (HttpURLConnection) u.openConnection();
        			con.setRequestMethod("POST");
        			con.setConnectTimeout(6000);
        			con.setDoOutput(true);
        			con.setDoInput(true);
        			con.setUseCaches(false);
        			con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        			OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream(), "UTF-8");
        			osw.write(sb.toString());
        			osw.flush();
        			osw.close();
        		} catch (Exception e) {
        			e.printStackTrace();
        		} finally {
        			if (con != null) {
        				con.disconnect();
        			}
        		}
        
        		// 讀取返回內容
        		StringBuffer buffer = new StringBuffer();
        		try {
        			BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
        			String temp;
        			while ((temp = br.readLine()) != null) {
        				buffer.append(temp).append("\n");
        			}
        		} catch (Exception e) {
        			e.printStackTrace();
        		}
        		return buffer.toString();
        	}
        
        	public static String MD51(String str) {
        		MessageDigest md5 = null;
        		try {
        			md5 = MessageDigest.getInstance("MD5");
        		} catch (Exception e) {
        			e.printStackTrace();
        			return "";
        		}
        		char[] charArray = str.toCharArray();
        		byte[] byteArray = new byte[charArray.length];
        		for (int i = 0; i < charArray.length; i++)
        			byteArray[i] = (byte) charArray[i];
        		byte[] md5Bytes = md5.digest(byteArray);
        		StringBuffer hexValue = new StringBuffer();
        		for (int i = 0; i < md5Bytes.length; i++) {
        			int val = ((int) md5Bytes[i]) & 0xff;
        			if (val < 16) {
        				hexValue.append("0");
        			}
        			hexValue.append(Integer.toHexString(val));
        		}
        		return hexValue.toString();
        	}
        
        	public final static String MD5(String s) {
        		char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
        		try {
        			byte[] btInput = s.getBytes();
        			// 獲得MD5摘要算法的 MessageDigest 對象
        			MessageDigest mdInst = MessageDigest.getInstance("MD5");
        			// 使用指定的字節更新摘要
        			mdInst.update(btInput);
        			// 獲得密文
        			byte[] md = mdInst.digest();
        			// 把密文轉換成十六進制的字符串形式
        			int j = md.length;
        			char str[] = new char[j * 2];
        			int k = 0;
        			for (int i = 0; i < j; i++) {
        				byte byte0 = md[i];
        				str[k++] = hexDigits[byte0 >>> 4 & 0xf];
        				str[k++] = hexDigits[byte0 & 0xf];
        			}
        			return new String(str);
        		} catch (Exception e) {
        			e.printStackTrace();
        			return null;
        		}
        	}
        }
        php
         date_default_timezone_set('PRC'); //設置時區為東八區否則時間比北京時間早8小時
         $url = 'http:///IP:Port/HttpSmsMt';//接口地址,請咨詢客服
         $mttime=date("YmdHis");
         $name = 'xxxxx';//開通的用戶名
         $password='xxxxx';//密碼
         $post_data['name']  = $name;
         $post_data['pwd'] = md5($password.$mttime);
         $post_data['content'] = '【閱信】驗證碼888888。';
         //$post_data['content'] = '123456'; 語音驗證碼內容
         $post_data['phone']    = '13400000000';//手機號碼
         $post_data['subid']    = '';
         $post_data['mttime']=$mttime;
         $post_data['rpttype']    = '1';
         $o = "";
         foreach ( $post_data as $k => $v )
          {
        	  $o.= "$k=" . urlencode( $v ). "&" ;
          }
         $post_data = substr($o,0,-1);
         $res = request_post($url, $post_data);
         print $res;
        
        
        /**
         * 模擬post進行url請求
         * @param string $url
         * @param string $param
         */
        function request_post($url = '', $param = '') {
        	if (empty($url) || empty($param)) {
        		return false;
        	}
        
        	$postUrl = $url;
        	$curlPost = $param;
        	$ch = curl_init();//初始化curl
        	curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定網頁
        	curl_setopt($ch, CURLOPT_HEADER, 0);//設置header
        	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求結果為字符串且屏幕上
        	curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
        	curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
        	$data = curl_exec($ch);//運行curl
        	curl_close($ch);
        
        	return $data;
        }
        ?>
        ? 网上真人斗牛