Отправляйте разговоры на форумы с помощью приложения C#
Я хочу отправить разговор на форум веб-сайта на c#.
Что я уже пробовал:
// Create a request and pass the URL to receive the post. WebRequest request = WebRequest.Create(uri); // We set the Method property of the request to POST. request.Method = "POST"; // We create what is being sent by the POST method and convert it to byte array. string postData = "my text message"; byte[] byteArray = Encoding.UTF8.GetBytes(postData); // We set the ContentType of the WebRequest to xml. request.ContentType = "text/xml"; // We set the ContentLength of the WebRequest. request.ContentLength = byteArray.Length; // We get the request stream. Stream dataStream = request.GetRequestStream(); // write the data to the request stream. dataStream.Write(byteArray, 0, byteArray.Length); // create the Stream object. dataStream.Close();