苏飞论坛
标题: 为什么用httphelper登陆论坛总是提示密码没有提交上 [打印本页]
作者: SillyPGM 时间: 2013-3-21 10:47
标题: 为什么用httphelper登陆论坛总是提示密码没有提交上
本帖最后由 SillyPGM 于 2013-3-21 12:17 编辑
[code=csharp]HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = @"http://bbs.125.la/member.php?mod=logging&action=login&loginsubmit=yes&frommessage&loginhash=Lc6Qr&inajax=1",
Method="post",
Postdata = "formhash=e518b502&referer=http%3A%2F%2Fbbs.125.la%2Fhome.php%3Fmod%3Dspacecp%26ac%3Dprofile&username=%C7%E1%C6%AE%C6%AE%B5%C4%D4%C6&password=dc483e80a7a0bd9ef71d8cf973673924&questionid=0&answer=",
ResultType=ResultType.String,
};
HttpResult result= http.GetHtml(item);
string html = result.Html;
Console.WriteLine(html);
Console.ReadKey();
[/code]
作者: 站长苏飞 时间: 2013-3-21 11:21
我晕,你要登录我的论坛啊?不好意思我帮不了你,你见过,有人帮助你攻击自己网站的吗?
作者: SillyPGM 时间: 2013-3-21 11:42
站长苏飞 发表于 2013-3-21 11:21 
我晕,你要登录我的论坛啊?不好意思我帮不了你,你见过,有人帮助你攻击自己网站的吗?
举例而已,不要多想,你随便试一个论坛都可以,我试了,都是失败。
作者: 站长苏飞 时间: 2013-3-21 11:55
SillyPGM 发表于 2013-3-21 11:42 
举例而已,不要多想,你随便试一个论坛都可以,我试了,都是失败。
失败肯定是人家论坛有防范方式,或者是你写的代码不对。你使用FirBug取一个就知道了。不要多想是不假,那你用我的网站我没办法帮你, 帮你测试成功了我不能Sb了
作者: 站长苏飞 时间: 2013-3-21 12:38
- HttpHelper http = new HttpHelper();
- HttpItem item = new HttpItem()
- {
- URL = "http://bbs.125.la/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1&handlekey=ls&password=dc483e80a7a0bd9ef71d8cf973673924&quickforward=yes&username=%C7%E1%C6%AE%C6%AE%B5%C4%D4%C6",
- Method="get",
- ResultType=ResultType.String
- };
- HttpResult result= http.GetHtml(item);
- string html = result.Html;
- Console.WriteLine(html);
- Console.ReadKey();
复制代码
作者: SillyPGM 时间: 2013-3-21 12:48
站长苏飞 发表于 2013-3-21 12:38 
咋变成get了,晕倒。
作者: 站长苏飞 时间: 2013-3-21 12:49
SillyPGM 发表于 2013-3-21 12:48 
咋变成get了,晕倒。
成功了吗,你试试,我测试正常,Get与Post只是发送的一种方式,这和程序本身没有关系吧。就你是顺风快递,和安利快递一样,你用那个效果都是一样的。
作者: SillyPGM 时间: 2013-3-21 12:51
站长苏飞 发表于 2013-3-21 12:49 
成功了吗,你试试,我测试正常,Get与Post只是发送的一种方式,这和程序本身没有关系吧。就你是顺风快递, ...
我纳闷在于,抓包显示的post模式,url和postdata也是分开的。为什么要写一起。这是必须的吗?
作者: 站长苏飞 时间: 2013-3-21 12:59
SillyPGM 发表于 2013-3-21 12:51 
我纳闷在于,抓包显示的post模式,url和postdata也是分开的。为什么要写一起。这是必须的吗?
你想使用Post也行,只需要简单修改两个参数就行了, 看我下面的代码- HttpHelper http = new HttpHelper();
- HttpItem item = new HttpItem()
- {
- URL = "http://bbs.125.la/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1",
- Method = "post",
- Postdata = "username=%C7%E1%C6%AE%C6%AE%B5%C4%D4%C6&password=dc483e80a7a0bd9ef71d8cf973673924&quickforward=yes&handlekey=ls",
- ResultType = ResultType.String
- , PostDataType=PostDataType.String,
- Referer="http://bbs.125.la/member.php",
- ContentType = "application/x-www-form-urlencoded"
- };
- HttpResult result = http.GetHtml(item);
- string html = result.Html;
复制代码
作者: 站长苏飞 时间: 2013-3-21 13:01
因为Post数据时需要上传流格式为application/x-www-form-urlencoded,而你没有设置默认的是Text 或者是Html的,所以肯定上传不上去数据
作者: SillyPGM 时间: 2013-3-21 13:18
站长苏飞 发表于 2013-3-21 13:01 
因为Post数据时需要上传流格式为application/x-www-form-urlencoded,而你没有设置默认的是Text 或者是Html ...
谢谢飞哥的解释,我应该好好看看你这个源码了。没细看,直接用的。杯具。
作者: 站长苏飞 时间: 2013-3-21 13:21
SillyPGM 发表于 2013-3-21 13:18 
谢谢飞哥的解释,我应该好好看看你这个源码了。没细看,直接用的。杯具。
我的类只是做最基础的发送与接收数据,一般不会因为这个类无法获取,大部分是因为参考没有写好,或者是没有看准确Fribug获取的数据,特别是Post时一定要看清是什么样的上传类型,
(, 下载次数: 120)