我需要到达其响应postvar“数据”的web服务。 如何设置在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();
有帮助吗?

解决方案

响应postvar “数据”的只是意味着你postData字符串需要形式"data=mydata"的?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top