C#短信接口demo_C#短信验证码接口_C#短信验证接口代码示例_动力思维乐信
代码示例

代码下载C#代码示例 在线技术支持

	void SendSms(String accName,String accPwd,String aimcodes,String content)
	{
	    string formUrl = "http://www.jor-store.com/sdk/send";//url地址
	    string ReStr;
        //参数
        string formData="" ;
        DateTime Date= DateTime.Now;

        formData = formData +  "&accName=" +accName.Trim() + 
        	"&accPwd=" + MD5Encrypt32(accPwd.Trim())+
        	"&content=" +content.Trim() + 
        	"&aimcodes=" +aimcodes.Trim(); 

        CookieContainer cookieContainer = new CookieContainer();
        // 将提交的字符串数据转换成字节数组
        //byte[] postData = Encoding.UTF8.GetBytes(formData);
        Encoding myc= Encoding.GetEncoding("UTF-8");
        byte[] postData =myc.GetBytes(formData);
        // 设置提交的相关参数
        HttpWebRequest request = WebRequest.Create(formUrl) as HttpWebRequest;
        Encoding myEncoding = Encoding.GetEncoding("UTF-8");
        request.Method = "POST";
        request.KeepAlive = false;
        request.AllowAutoRedirect = true;
        request.ContentType = "application/x-www-form-urlencoded";
        request.CookieContainer = cookieContainer;
        request.ContentLength = postData.Length;

        // 提交请求数据
        System.IO.Stream outputStream = request.GetRequestStream();
        outputStream.Write(postData, 0, postData.Length);
        outputStream.Close();

        HttpWebResponse response;
        Stream responseStream;
        StreamReader reader;
        string srcString;
        response = request.GetResponse() as HttpWebResponse;
        responseStream = response.GetResponseStream();
        reader = new System.IO.StreamReader(responseStream, Encoding.UTF8);
        ReStr = reader.ReadToEnd(); //返回值
        Console.WriteLine( "错误信息:" + ReStr);
        reader.Close();		
	}
	//MD5加密
	public static string MD5Encrypt32(string password)
        {
            string strEncrypt = string.Empty;
            strEncrypt = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            return strEncrypt; 
        }
悠洋棋牌下载 上海11选5走势图 上海11选5走势图 上海11选5分布走势图 上海11选5 悠洋棋牌 上海11选5 上海11选5 上海11选5 上海11选5