httprequest에서 postvar의 이름을 설정하는 방법은 무엇입니까?
-
22-07-2019 - |
문제
PostVar "데이터"에 응답하는 웹 서비스에 도달해야합니다. 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();
해결책
그렇지 않습니다 PostVar "데이터"에 응답합니다. 단순히 당신을 의미합니다 postData
문자열은 형식이어야합니다 "data=mydata"
?
제휴하지 않습니다 StackOverflow