my6731083 2015-07-23 09:43 采纳率: 0%
浏览 1542

求大神把这段代码完成的功能用asp代码写出来

protected void Button1_Click(object sender, System.EventArgs e)
{
XmlDocument doc = new XmlDocument();
String Account = TextBox1.Text.ToString();
String Password = TextBox2.Text.ToString();
String url = "http://3tong.net/http/sms/Submit";
String Phone = TextBox3.Text.ToString();
String sendtime = TextBox4.Text.ToString();
String sign = TextBox5.Text.ToString();
String subcode = TextBox6.Text.ToString();
String Content = TextBox8.Text.ToString();
String msgid = TextBox7.Text.ToString();
String message = DocXml(Account,Password,msgid,Phone,Content,subcode,sendtime,sign);

    WebClient webClient = new WebClient();
    NameValueCollection postValues = new NameValueCollection();
    postValues.Add("message", message);


    //向服务器发送POST数据
    byte[] responseArray = webClient.UploadValues(url, postValues);
    TextBox9.Text = Encoding.UTF8.GetString(responseArray);
}
  • 写回答

2条回答

  • my6731083 2015-07-23 10:16
    关注

    private static string DocXml(string account, string password, string msgid, string phones, string content,string subcode,string sendtime,string sign)
    {
    XmlDocument doc = new XmlDocument();
    XmlNode xmlnode = doc.CreateXmlDeclaration("1.0", "utf-8", null);
    doc.AppendChild(xmlnode);
    XmlElement xe1 = doc.CreateElement("response");
    XmlElement sub1 = doc.CreateElement("account");
    sub1.InnerText = account;
    xe1.AppendChild(sub1);
    XmlElement sub2 = doc.CreateElement("password");
    sub2.InnerText = md5(password);
    xe1.AppendChild(sub2);
    XmlElement sub3 = doc.CreateElement("msgid");
    sub3.InnerText = msgid;
    xe1.AppendChild(sub3);
    XmlElement sub4 = doc.CreateElement("phones");
    sub4.InnerText = phones;
    xe1.AppendChild(sub4);
    XmlElement sub5 = doc.CreateElement("content");
    sub5.InnerText = content;
    xe1.AppendChild(sub5);
    XmlElement sub6 = doc.CreateElement("subcode");
    sub6.InnerText = subcode;
    xe1.AppendChild(sub6);
    XmlElement sub7 = doc.CreateElement("sendtime");
    sub7.InnerText = sendtime;
    xe1.AppendChild(sub7);
    XmlElement sub8 = doc.CreateElement("sign");
    sub8.InnerText = sign;
    xe1.AppendChild(sub8);
    doc.AppendChild(xe1);
    return xe1.OuterXml;
    }

    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序