

After that you make a variable of type Uri in which you save the URL. You can find the correct URL with the addon Live HTTP headers explained in part 1 of the tutorial. First you need to know the URL you want to request. I’ll start with the method defaultGetRequest(). When you’re learning http requests or just want to try a few things it’s not really a problem but when you want to make a complete program with GUI it can be very irritating when your interface stops responding during every request. This means that when you request a webpage or file your program will freeze till the request is completed.

The methods defaultGetRequest() and defaultPostRequest() are both blocking. Let’s open MyBot_Tutorial.cs.Īs I said before, the basic method has a disadvantage. Now we can finally start with the requests. (request as HttpWebRequest).CookieContainer = m_container WebRequest request = base.GetWebRequest(address) Protected override WebRequest GetWebRequest(Uri address) Private CookieContainer m_container = new CookieContainer() I have also added an other method to this class called clearCookies() but will explain that in part 3 of the tutorial. This way the cookies are updated with every request that we make. To solve this we use the custom class HttpHandler that is derived from WebClient and add our own CookieContainer. But the limitation of this class is that is doesn’t handle cookies well. The methods that we are going to use for the http requests are from the class WebClient from the. Let’s start by opening the file HttpHandler.cs.
#GREPOLIS BOT DETECTION DOWNLOAD#
I have made a project that uses all the methods that I’m going to explain, you can download it here. The other method is more advanced but that shouldn’t be a problem after the tutorial. A basic method that is great to use for the first time and to do some tests, but it has a disadvantage. In this tutorial I will explain two methods for sending http requests.
#GREPOLIS BOT DETECTION CODE#
In the next part of the tutorial I’ll explain how you can write C# code to make your own POST and GET requests.

This are the basics you need to know to work with http requests. Unit=sword&amount=10The content contains a number of name-value pairs that are separated with the &-char. In Live HTTP headers you will see the following: I’ll be using Live HTTP Headers in this tutorial. An example were this is used is by all the browser based games when you login by entering your username and password.įor an example of a GET request you can go to any page in your browser while using one of the above tools. This is almost always used when you have to fill in a form. So when browsing through a site clicking some links, that will be GET requests.Ī POST request does also return the data you requested just like the GET request but with a POST request you can also send data with the request. While using one of the above tools you will see that most of the requests are a GET request.Ī GET requests does nothing more then returning the data you requested. Or if you want to use a separate program you can use WireShark. The easiest method is using a Firefox plugin called Live HTTP Header, or Httpfox. There are many tools for this that you can use.

The first step to make when starting with a bot is playing the game in your browser and watching the http requests. There are different ways to make a bot, in current tutorials I will explain how you can make a bot that uses http requests.
#GREPOLIS BOT DETECTION SERIES#
This is a series of tutorials with explanation how you can make your own bots for browser games like grepolis, travian and so on. Writing Bots for browser games based on http requests
