The post request needs to have all 4 fields.
username
password
Login=Login
And the LT Signature which changes each time the page is reloaded.
Post byte data should be:
username=<account>&password=<password><=<lt signature that you grabbed from some form of regex>&Login=Login
Maybe that helps a bit. Keep in mind, it's https, not http. So a few extra measures are needed.
Quick snippet of what you would do in C#.
Code:
LTSignature = WebPage.GetWebPageRegex(@"https://www.worldofwarcraft.com/login/login?service=https%3A%2F%2Fwww.worldofwarcraft.com%2Faccount%2Findex.html");
string PostDataStr = "username=" + txtAccount.Text + "&password=" + txtPassWord.Text + "<=" + LTSignature + "&Login=Login";
byte[] post_data = Encoding.UTF8.GetBytes(PostDataStr);
string additional_headers = "Content-Type: application/x-www-form-urlencoded";
webBrowser1.Navigate(@"https://www.worldofwarcraft.com/login/login?service=https%3A%2F%2Fwww.worldofwarcraft.com%2Faccount%2Findex.html", "", post_data, additional_headers);
And the regex grabber:
Code:
public static string GetWebPageRegex(string url)
{
var rx = new Regex(@"(?<=B<input type=""hidden"" name=""lt"" value="").+b");
var webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Timeout = 6000;
var webResponse = (HttpWebResponse)webRequest.GetResponse();
Stream responseStream = webResponse.GetResponseStream();
string responseEncoding = webResponse.ContentEncoding.Trim();
if (responseEncoding.Length == 0)
{
responseEncoding = "us-ascii";
}
var responseReader = new StreamReader(responseStream, Encoding.GetEncoding(responseEncoding));
Match _match = rx.Match(responseReader.ReadToEnd());
return _match.ToString();
}
Of course having a var defined somewhere for the LTSignature.
Hope that helps some.