点击这里给我发消息
帮助中心

工作时间:8:30 - 17:30

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://sms.106jiekou.com/utf8/sms.aspx";
    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
        {
            //访问失败
        }
    }
}