Johan Ehrendahl
Member
we are trying to login into our studio forums using C#, and it doesn't work (We get
Error 503 (Server is unavailable)). Any ideas if its possible and/or how to make it work?
note: It doesn't work with POST through the web-browser either.
Cheers!
Error 503 (Server is unavailable)). Any ideas if its possible and/or how to make it work?
note: It doesn't work with POST through the web-browser either.
Cheers!
PHP:
try
{
HttpWebRequest http = WebRequest.Create("http://reperio-studios.net/index.php?login/login") as HttpWebRequest;
http.Host = "reperio-studios.net";
http.KeepAlive = true;
http.Method = "POST";
http.AllowAutoRedirect = true;
http.Referer = "http://reperio-studios.net/index.php";
http.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
http.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36 OPR/24.0.1558.61";
http.ContentType = "application/x-www-form-urlencoded";
string postData = "login=" + labelName.Text + "®ister=0&password=" + writableField1.GetText() + "&remember=1&cookie_check=0&redirect=%2F&_xfToken=";
byte[] dataBytes = UTF8Encoding.UTF8.GetBytes(postData);
http.ContentLength = dataBytes.Length;
using (Stream postStream = http.GetRequestStream())
{
postStream.Write(dataBytes, 0, dataBytes.Length);
}
HttpWebResponse httpResponse = http.GetResponse() as HttpWebResponse;
http = WebRequest.Create("http://reperio-studios.net/") as HttpWebRequest;
http.CookieContainer = new CookieContainer();
http.CookieContainer.Add(httpResponse.Cookies);
http.AllowAutoRedirect = false;
HttpWebResponse httpResponse2 = http.GetResponse() as HttpWebResponse;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Catch Debug");
}