I'm not familiar with http content, but how can I submit data to a website? Is a submit button that I want to "press" from the console app. This is not my own website.
This page is part of the source; it is not certain that there is any relevance to it:
& lt; Form action = "rate.php" method = "post" & gt;
I looked at the HttpWebRequest class but I am unfamiliar with those qualities which I need to fill.
Sorry, I'm very ambiguous but I'm not familiar with it
MSDN is AC / P.
/ / Prepare a request using a URL that can receive posts. WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx"); // Set the property property of request to post. request. Method = "post"; // Create the post data and convert it to a byte array. String postData = "This is an exam that posts this string to a web server."; Byte [] Bytere = Encoding. UTF8.GetBytes (PostData); // Set the ContentType property of WebRequest Request.ContentType = "application / x-www-form-urlencoded"; // Set the ContentLength property of WebRequest Request.ContentLength = byteArray.Length; // Receive Request Stream Stream Data Stream = Request. GETRequestStream (); // Write the data in the request stream. Datastream Write (byte, 0, byte length); // Close the stream object Datastream.Close (); // Receive feedback WebResponse response = Request GetResponse (); // Display the status console. Light line (((HTTP web response) response). TETS DESCRIPTION); // Receive stream containing content returned from server datastream = response. Gateresonsstream (); // Open stream using stream reader for easier access; Streamminder Reader = new streamrider (datastream); // Read String Response Forms = Reader Readout (); // Display content console; light line (responseformser); // Clear the currents reader Stop it (); Datastream.Close (); reaction. Stop it ();
This process is very simple but first you need to know what you need to send and any other special encoding / cookies etc ... Which can be needed I recommend that you and / or use it for Firefox. One can see all the requests that work through a web page, then you can duplicate the same behavior in your app.
Comments
Post a Comment