首页 > 其他 > 详细

后台post

时间:2017-08-31 17:41:19      阅读:246      评论:0      收藏:0      [点我收藏+]

抄来的例子

string url = "http://wx.sysmex.com.cn:8080/Utility/AddressBookSync.aspx";
                    string postData = "method=sync";

      postData+="&data2=xxx";

                    ASCIIEncoding encoding = new ASCIIEncoding();
                    byte[] data = encoding.GetBytes(postData);
                    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);

                    myRequest.Method = "POST";
                    myRequest.ContentType = "application/x-www-form-urlencoded";
                    myRequest.ContentLength = data.Length;
                    Stream newStream = myRequest.GetRequestStream();

                    newStream.Write(data, 0, data.Length);
                    newStream.Close();

                    HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
                    StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);
                    string content = reader.ReadToEnd();
                    reader.Close();

后台post

原文:http://www.cnblogs.com/forekoy/p/7459356.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!