本帖最后由 努力学习 于 2013-12-14 16:25 编辑
连接为: https://secure.square-enix.com/a ... 6e45b8ee95a899d67ba
作用是验证输入信息后是返回的提示。
我先get这个页面的值,里面有几个hidden的值,我先得到。
再输入用户名和密码进行post。
然后就返回一个页面,再对那个页面进行跳转,最后得到的页面就是我最开始打开的页面。
代码如下:
[C#] 纯文本查看 复制代码 HttpHelper httpHelper = new HttpHelper();
HttpItem httpItem = new HttpItem();
HttpResult httpResult = null;
////先空的访问一次,然后再进行获取值后再访问
httpItem.Method = "GET";
httpItem.URL = "https://secure.square-enix.com/account/app/svc/register2?id=15d38cf138a556e45b8ee95a899d67ba";
httpResult = httpHelper.GetHtml(httpItem);
//得到这个里面的隐藏的信息
// Console.WriteLine(httpResult.Html);
string strreg1 = "name=\"_seq\" value=\"(.*)\" />";
string strreg2 = "name=\"_url\" value=\"(.*)\" />";
string strreg3 = "name=\"_event\" value=\"(.*)\" />";
string strreg4 = "name=\"_st_regDat3\" value=\"(.*)\" />";
string strreg5 = "name=\"_st_birthday\" value=\"(.*)\" />";
string strreg6 = "name=\"_st_redirectInfo\" value=\"(.*)\" />";
string strreg7 = "name=\"_st_rWallet\" value=\"(.*)\" />";
string strreg8 = "name=\"_st_dupSqexid\" value=\"(.*)\" />";
string str_seq = Regex.Match(httpResult.Html, strreg1).Groups[1].Value;
string str_url = Regex.Match(httpResult.Html, strreg2).Groups[1].Value;
string str_event = Regex.Match(httpResult.Html, strreg3).Groups[1].Value;
string str_st_regDat3 = Regex.Match(httpResult.Html, strreg4).Groups[1].Value;
string str_st_birthday = Regex.Match(httpResult.Html, strreg5).Groups[1].Value;
string str_st_redirectInfo = Regex.Match(httpResult.Html, strreg6).Groups[1].Value;
string str_st_rWallet = Regex.Match(httpResult.Html, strreg7).Groups[1].Value;
string str_st_dupSqexid = Regex.Match(httpResult.Html, strreg8).Groups[1].Value;
string cookie;
if(httpResult.CookieCollection ==null)
{
cookie = httpResult.Cookie;
}
else
{
StringBuilder my_cookie = new StringBuilder();
foreach (Cookie c in httpResult.CookieCollection)
{
my_cookie.Append(c.Name + "=" + c.Value + ";");
}
cookie = my_cookie.ToString();
}
httpItem = new HttpItem();
httpItem.KeepAlive = true;
Console.WriteLine("the hidden value is {0},{1},{2},{3},{4},{5},{6},{7} ", str_seq, str_url, str_event, str_st_regDat3, str_st_birthday, str_st_redirectInfo, str_st_rWallet, str_st_dupSqexid);
//httpItem.CookieCollection = httpResult.CookieCollection;
// httpItem.CookieCollection = httpResult.CookieCollection;
// httpItem.CookieCollection.Add(new Cookie("cis_sessid","738feff7ee45b16722ae307ee1cac3aa169fae012a46704d22e50e7f"));
// httpItem.CookieCollection.Add(new Cookie("_cf", "0"));
//httpItem.ResultCookieType = ResultCookieType.CookieCollection;
//httpItem.CookieCollection = httpResult.CookieCollection;
//httpItem.Cookie = httpResult.Cookie;
httpItem.Cookie = cookie;
httpItem.Encoding = Encoding.UTF8;
httpItem.Header.Add("Accept-encoding", "gzip, deflate");[url=https://secure.square-enix.com/account/app/svc/register2?id=15d38cf138a556e45b8ee95a899d67ba]https://secure.square-enix.com/a ... 6e45b8ee95a899d67ba[/url]
// httpItem.Referer = "https://secure.square-enix.com/account/app/svc/register2?id=15d38cf138a556e45b8ee95a899d67ba";
httpItem.Method = "POST";
httpItem.URL = "https://secure.square-enix.com/account/app";
// httpItem.Cookie = "cis_sessid=738feff7ee45b16722ae307ee1cac3aa169fae012a46704d22e50e7f;_cf=0";
httpItem.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0";
httpItem.Host = "secure.square-enix.com";
httpItem.Postdata = "_seq=" + str_seq + "&_url=" + str_url + "&_event=Submit&_st_regDat3=" + str_st_regDat3 + "&_st_birthday=" + str_st_birthday + "&_st_redirectInfo=" + str_st_redirectInfo + "&_st_rWallet=" + str_st_rWallet + "&_st_dupSqexid=" + str_st_dupSqexid + "&_pr_regDat1_contry=JP&_pr_regDat1_sqexid=av&_pr_regDat1_sqexPw=11111111111111&_pr_regDat1_sqexPwConf=11111111111111&_pr_regDat1_birthYear=0&_pr_regDat1_birthMonth=0&_pr_regDat1_birthDay=0&_pr_regDat2_hash=";
httpItem.Cookie = cookie;
Console.WriteLine(httpItem.Postdata);
httpResult = httpHelper.GetHtml(httpItem);
Console.WriteLine(httpResult.Html.ToString());
//httpItem.Referer = "";
httpItem.Cookie = cookie;
httpItem.URL = "https://secure.square-enix.com/account/app/svc/Login?cont=account";
httpItem.Postdata = "_c=1";
httpResult = httpHelper.GetHtml(httpItem);
// if(httpResult.Html.IndexOf("error1")>0)
Console.WriteLine(httpResult.Html.ToString());
|