C#短信接口代码示范_C#短信接口案例-胜达短信平台公司

胜达短信平台公司

主页 > 短信接口 > 代码示范 > C#

[切换]

选择短信群发地区 :北京上海广州深圳
 
        C#:
 
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 = "http://www.xianbodi.com";
 
    protected void Page_Load(object sender, EventArgs e)
 
    {
 
 
 
    }
 
    protected void ButSubmit_Click(object sender, EventArgs e)
 
    {
 
        string account = this.TxtAccount.Text.Trim();
 
        string password = this.TxtPassword.Text.Trim();
 
        string mobile = this.TxtMobile.Text.Trim();
 
        string content = this。TxtContent。Text。Trim();
 
 
 
        string postStrTpl = "account={0}&password={1}&mobile={2}&content={3}";
 
 
 
        UTF8Encoding encoding = new UTF8Encoding();
 
        byte[] postData = encoding。GetBytes(string。Format(postStrTpl, account, password, mobile, content));
 
 
 
        HttpWebRequest myRequest = (HttpWebRequest)WebRequest。Create(PostUrl);
 
        myRequest.Method = "POST";
 
        myRequest。ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
 
        myRequest.ContentLength = postData.Length;
 
 
 
        Stream newStream = myRequest.GetRequestStream();
 
        // Send the data.
 
        newStream。Write(postData, 0, 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
 
        {
 
            //访问失败
 
        }
 
    }
 
}
 
胜达短信群发广西福彩网
微信二维码扫一扫
微信联系我们
短信群发网 联系QQ:2321952682 邮箱236815253@qq.com Copyright © 2002-2011 胜达短信平台公司 版权所有 网站地图 XML 网站关键词:短信 短信平台 短信群发 短信接口 短信群发平台