大佬教程收集整理的这篇文章主要介绍了.net短信接口调用示例(106短信通道),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
using System; using System.Data; using System.Configuration; using System.Collections; using System.IO; using System.Net; using System.Text; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Post : System.Web.UI.Page { public static String Posturl = ConfigurationManager.AppSetTings["WebReference.service.Posturl"]; protected void Page_Load(object sender,EventArgs E) { } protected void ButSubmit_Click(object sender,EventArgs E) { String sname = this.TxtSname.Text.Trim(); String spwd = this.TxtSpwd.Text.Trim(); String scorpid = this.TxtScorpid.Text.Trim(); String sprdid = this.TxtSprdid.Text.Trim(); String sdst = this.TxtSdst.Text.Trim(); String smsg = this.TxtSmsg.Text.Trim(); String postStrTpl = "sname={0}&spwd={1}&scorpid={2}&sprdid={3}&sdst={4}&smsg={5}"; UTF8Encoding encoding = new UTF8Encoding(); byte[] postData = encoding.GetBytes(String.Format(postStrTpl,sname,spwd,scorpid,sprdid,sdst,smsg)); httpWebrequest myrequest = (httpWebrequest)Webrequest.Create(Posturl); myrequest.Method = "POST"; myrequest.ContentType = "application/x-www-form-urlencoded"; myrequest.ContentLength = postData.Length; Stream newStream = myrequest.GetrequestStream(); // Send the data. newStream.Write(postData,postData.Length); newStream.Flush(); newStream.Close(); httpWebResponse myResponse = (httpWebResponsE)myrequest.GetResponse(); if (myResponse.StatusCode == httpStatusCode.oK) { StreamReader reader = new StreamReader(myResponse.GetResponseStream(),Encoding.UTF8); LabelRetmsg.Text = reader.ReadToEnd(); //反序列化upfileMmsMsg.Text //实现自己的逻辑 } else { //访问失败 } } }
以上是大佬教程为你收集整理的.net短信接口调用示例(106短信通道)全部内容,希望文章能够帮你解决.net短信接口调用示例(106短信通道)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。