我需要联系一个响应战后“数据”的网络服务。 如何使用httprequest在c#中设置此名称... 这就是我得到的:
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();
答案 0 :(得分:2)
不响应postvar“数据”只是意味着您的postData
字符串必须采用"data=mydata"
形式?