Hi, I want to code a auto bot for a online game (tribalwars.net) , I taking Programming A Lessons in CSharp (In School), but Network Programming coming in B or C
Anyway I wonder if it is possible to make http post though C#, Can give a example
Hi, I want to code a auto bot for a online game (tribalwars.net) , I taking Programming A Lessons in CSharp (In School), but Network Programming coming in B or C
Anyway I wonder if it is possible to make http post though C#, Can give a example
Here's a good example. You want to use the WebRequest class in C#, which will make this easy.
Request
HttpWebRequest request= (HttpWebRequest)WebRequest.Create(url);
request.ContentType="application/x-www-form-urlencoded";
request.Method = "POST";
request.KeepAlive = true;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(BytePost,0,BytePost.Length);
requestStream.Close();
}
Response
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using(StreamReader sr = new StreamReader(response.GetResponseStream()))
{
responseString = sr.ReadToEnd();
}
Trivial with System.Net.WebClient:
using(WebClient client = new WebClient()) {
string responseString = client.UploadString(address, requestString);
}
There is also:
byte[]
)