0

我需要访问一个响应 postvar“数据”的网络服务。如何在 c# 中使用 httprequest 设置此名称...这就是我得到的:

            UTF8Encoding encoding = new UTF8Encoding();
            byte[] data = encoding.GetBytes(postData); 

            HttpWebRequest myRequest =
              (HttpWebRequest)WebRequest.Create("http://secreturl/jubidubb.php");
            myRequest.Method = "POST";
            myRequest.ContentType = "application/x-www-form-urlencoded";
            myRequest.ContentLength = data.Length;
            myRequest.KeepAlive = true;
            Stream newStream = myRequest.GetRequestStream();


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

            // The response
            WebResponse response = myRequest.GetResponse();
4

1 回答 1

2

响应 postvar "data"仅仅意味着你的postData字符串需要是这种形式"data=mydata"吗?

于 2009-09-18T22:11:32.453 回答