飞哥 Post登录dz论坛的时候总是提示验证码错误
dz论坛的验证码地址是2次get得到的 我也是加了2次get
也代了cookies请求验证码 代了cookies post登录
一直都提示验证码错误 昨天烦了一天了 求飞哥帮助
辛苦飞哥了
[C#] 纯文本查看 复制代码 public partial class Form1 : Form
{
string formhash;
string loginHash;
string secondHash;
string cookiesQian;
public Form1()
{
InitializeComponent();
HttpHelper help = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://data.loulanpo.com/member.php?mod=logging&action=login",
Method = "get",
ContentType = "text/html; charset=gbk",
};
HttpResult result = help.GetHtml(item);
string html = result.Html;
cookiesQian = result.Cookie;
string idhash = HttpHelper.GetBetweenHtml(html, "<span id=\"seccode_", "\"></span>");
formhash = HttpHelper.GetBetweenHtml(html, "<input type=\"hidden\" name=\"formhash\" value=\"", "\" />");
loginHash = HttpHelper.GetBetweenHtml(html, "loginhash=", "\"");
secondHash = HttpHelper.GetBetweenHtml(html, "<span id=\"seccode_", "\"></span>");
string sssss = ConvertDateTimeInt(DateTime.Now);
HttpItem itemQian = new HttpItem()
{
URL = "http://data.loulanpo.com/misc.php?mod=seccode&action=update&idhash=" + idhash + "&"+ ConvertDateTimeInt(DateTime.Now) + "&modid=member::logging",
Referer = "http://data.loulanpo.com/member.php?mod=logging&action=login",
Method ="GET",
Cookie =cookiesQian,
};
HttpResult resultQian = help.GetHtml(itemQian);
string update = HttpHelper.GetBetweenHtml(resultQian.Html, "height=\"30\" src=\"", "\" class=");
HttpItem image1 = new HttpItem()
{
URL = "http://data.loulanpo.com/" + update,
Referer = "http://data.loulanpo.com/member.php?mod=logging&action=login",
Method = "GET",//URL 可选项 默认为Get
ContentType = "image/png",
Cookie = cookiesQian,
};
this.pictureBox1.Image = help.GetImage(image1);
}
/// <summary>
/// 将c# DateTime时间格式转换为Unix时间戳格式
/// </summary>
/// <param name="time">时间</param>
/// <returns>long</returns>
public static string ConvertDateTimeInt(System.DateTime time)
{
//double intResult = 0;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
long t = (time.Ticks - startTime.Ticks) / 10;
string s = "0." + t.ToString();
return s;
}
private void button1_Click(object sender, EventArgs e)
{
HttpHelper help = new HttpHelper();
HttpItem item2 = new HttpItem()
{
URL = "http://data.loulanpo.com/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=" + loginHash + "&inajax=1",
Method = "POST",
ContentType = "application/x-www-form-urlencoded",
Postdata = "formhash=" + formhash + "&referer=http%3A%2F%2Fdata.loulanpo.com%2F.%2F&loginfield=username&username=xioao&password=qw4&questionid=0&answer=&seccodehash=" + secondHash + "&seccodemodid=member%3A%3Alogging&seccodeverify=" + this.textBox3.Text.Trim(),
Cookie = cookiesQian,
};
string xxxx = "formhash=" + formhash + "&referer=http%3A%2F%2Fdata.loulanpo.com%2F.%2F&loginfield=username&username=xiabao&password=qw34&questionid=0&answer=&seccodehash=" + secondHash + "&seccodemodid=member%3A%3Alogging&seccodeverify=" + this.textBox3.Text.Trim();
HttpResult result = help.GetHtml(item2);
string sssswd = result.Html;
string cookies = result.Cookie;
}
}
|