捷信通为广大开发者提供短信发送接口c#程序源码,这个可以帮助c#程序员在自己的系统中集成短信发送功能。这段代码是c#短信接口的主要部分,如果要俩接更加详细的内容,请下载c#短信接口程序包微宏SDK(1.9):http://www.jiexintong.cn/aspcms/downlist/list-8-1.html
c#短信接口程序主要源码
public static string Send(string PhoneNumber, string SMSContent)
{
string tmp = "";
if (PhoneNumber != "")
{
string accountname = "sdktest";
string accountpwd = "";
Encoding encoding = Encoding.GetEncoding("GBK");
string postData = "accountname=" + accountname;
postData += ("&accountpwd=" + accountpwd);
postData += ("&mobilecodes=" + PhoneNumber);
postData += ("&msgcontent=" + SMSContent);
byte[] data = encoding.GetBytes(postData);
// Prepare web request
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://csdk.zzwhxx.com:8002/submitsms.aspx");
myRequest.Method = "POST";
myRequest.Timeout = 10000;
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
//接收返回信息:
HttpWebResponse response = (HttpWebResponse)myRequest.GetResponse();
StreamReader sreader = new StreamReader(response.GetResponseStream(), Encoding.Default);
tmp = sreader.ReadToEnd();
}
return tmp;
}
提醒各位c#程序员,我们的短信接口有可以免费测试,在开发短信接口的过程中,请联系我们的为你开通免费测试。
开通免费测试接口的方式和如何申请免费短信代发平台方式一样!
文章相关标签:短信发送接口,c#代码,.net短信接口
|
评论加载中...
|