Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 10:19

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



c# httpwebrequest Travian

Discussion on c# httpwebrequest Travian within the .NET Languages forum part of the Coders Den category.

Closed Thread
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2011
Posts: 2
Received Thanks: 0
c# httpwebrequest Travian

Gude Leute ich hätt da mal ein anliegen ich will mir ein kleines Tool zur vereinfachten bedinung von Travian schreiben nur leider bekomme ich das irgendwie nicht auf die Reihe.

da mein Code nicht so recht funktioniert hat habe ich mir den code von jemand anderes mal geklaut aber der ergibt das gleiche problem.

Das Probleme ist er zeigt die Seite nicht richtig an und er baut keine truppen wenn ich auf Button1 click.

wenn mir einer das vielleicht mal flicken könnte oder mir erklären könnte wie ich das hinbekomme wäre genial vielen dank schonmal.

hier der Code:
Code:
            public string GetHtml(string Url)
            {
                request = (HttpWebRequest)HttpWebRequest.Create(Url);
                request.Referer = "http://ts10.travian.de/dorf1.php";
                request.AllowAutoRedirect = true;
                request.ServicePoint.Expect100Continue = false;
                request.Timeout = 10000;
                request.CookieContainer = cookieContainer;
                request.Method = "GET";
                request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5";


                response = (HttpWebResponse)request.GetResponse();
                Console.WriteLine();
                sr = new StreamReader(response.GetResponseStream());
                string html = sr.ReadToEnd();
                sr.Close();
                response.Close();

                return html;
            }
            private void Form1_Load(object sender, EventArgs e)
            { }


            private void Loginbutton_Click(object sender, EventArgs e)
            {
                HttpWebResponse res;
                HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://ts10.travian.de/dorf1.php");
                req.AllowAutoRedirect = true;
                req.Method = "POST";
                req.ServicePoint.Expect100Continue = false;
                req.Timeout = 10000;
                req.CookieContainer = cookieContainer;
                req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3";
                req.ContentType = "application/x-www-form-urlencoded";


                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] loginDataBytes = encoding.GetBytes("name=******&password=******&s1=Einloggen&login=1295028699");
                req.ContentLength = loginDataBytes.Length;

                Stream stream = req.GetRequestStream();
                stream.Write(loginDataBytes, 0, loginDataBytes.Length);
                stream.Close();


                res = (HttpWebResponse)req.GetResponse();

                res.Close();
                webBrowser1.DocumentText = GetHtml("http://ts10.travian.de/dorf1.php");

            }

            private void button1_Click(object sender, EventArgs e)
            {
                HttpWebResponse res;
                HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://ts10.travian.de/dorf1.php");
                req.AllowAutoRedirect = true;
                req.Method = "POST";
                req.ServicePoint.Expect100Continue = false;
                req.Timeout = 10000;
                req.CookieContainer = cookieContainer;
                req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3";
                req.ContentType = "application/x-www-form-urlencoded";


                ASCIIEncoding encoding = new ASCIIEncoding();
                byte[] loginDataBytes = encoding.GetBytes("id=32&a=2&t1=1&t3=0&t4=0&s1=ok");
                req.ContentLength = loginDataBytes.Length;

                Stream stream = req.GetRequestStream();
                stream.Write(loginDataBytes, 0, loginDataBytes.Length);
                stream.Close();


                res = (HttpWebResponse)req.GetResponse();

                

                webBrowser1.DocumentText = GetHtml("http://ts10.travian.de/build.php?id=32");
                
            }
Es geht um die Travian 4 Beta ^^
R4z3r_Tech is offline  
Old 01/16/2011, 21:08   #2
 
elite*gold: 0
Join Date: Jan 2011
Posts: 2
Received Thanks: 0
kann mir keiner helfen hat keiner ne ahnung woran es liegt ???
R4z3r_Tech is offline  
Old 12/07/2017, 02:18   #3
 
elite*gold: 0
Join Date: Jan 2014
Posts: 370
Received Thanks: 167
Hast du dem WebBrowser die Cookies übergeben ? hast du den IE richtig eingestellt ?
Onkelmat is offline  
Closed Thread


Similar Threads Similar Threads
HttpWebRequest C# Browsergame Bot
12/07/2017 - .NET Languages - 4 Replies
Hi, i have the following problem and it would be great if s.o. could help me. I try to write a simple bot for a browsergame which uses the HttpWebRequest and Response classes from C#. Currently i try to log in with the following script but i only get back to the login page. When i try to catch a site for logged in members only i also only get the login page. There has to be a problem with the cookie but i don't know where :( class HttpHelper { private CookieContainer...
[C#]MD5-Cheksumme mit HttpWebRequest oä
08/18/2010 - .NET Languages - 1 Replies
Ich will mir mal einen gescheiten Patcher für Metin2 machen.. Jetzt soll er von den Files auf meinem Server die Checksummen ausspucken. Die Datei sollte nicht heruntergeladen werden... System.IO.FileStream FileCheck = System.IO.File.OpenRead(Dateipfad); System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvi der(); byte md5Hash = md5.ComputeHash(FileCheck);
Travian
09/24/2009 - Browsergames - 4 Replies
i am tryed find travian bot. i have tryed find from forum but only found german one and i dont speak german and from google but nothing. any u guys wana share a bot ?



All times are GMT +2. The time now is 10:19.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.