网址 : http://www.cppinfo.com/pdm/business/site/cip/siteAppNo.jsp
验证码地址:http://www.cppinfo.com/pdm/business/site/util/imageForCip.jsp?isDecorator=false
测试id : cip核字号2011075556 再填入验证码 点验证 会有页面数据显示环境 : delphi 7+indy10 winxp sp3 ie8
我是这么做的 先 get 获取 验证码 再模拟post 总是获取不到跳转的页面 代码 :var
stream: TStringStream; s:string;begin
EditURL.Text :='http://www.cppinfo.com/pdm/business/site/cip/siteAppNo.jsp';
with IdHTTP do
begin
Request.Accept := 'image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-ms-application, application/x-ms-xbap,'
+ 'application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight, application/msword, */*';
Request.AcceptEncoding :='gzip, deflate';
Request.AcceptLanguage :='zh-cn';
Request.CacheControl :='no-cache';
Request.Connection :='Keep-Alive';
Request.ContentLength :=35;
Request.Host :='www.cppinfo.com';
Request.Referer :='http://www.cppinfo.com/pdm/business/site/cip/siteAppNo.jsp';
Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E)';
Request.ContentType := 'application/x-www-form-urlencoded';
HandleRedirects := true; AllowCookies :=true;
end;
stream:=TStringStream.Create('approveNo=2011075556&captchaNo='+edit2.Text); try try s:=IdHTTP.Post(EditURL.Text, stream );
Memo1.Clear ;
Memo1.Lines.Add(s ); except
ShowMessage('login fail');
end; finally
stream.Free ;
end;
end;是验证码不对还是 此网站有防护 不可以被模拟post
验证码地址:http://www.cppinfo.com/pdm/business/site/util/imageForCip.jsp?isDecorator=false
测试id : cip核字号2011075556 再填入验证码 点验证 会有页面数据显示环境 : delphi 7+indy10 winxp sp3 ie8
我是这么做的 先 get 获取 验证码 再模拟post 总是获取不到跳转的页面 代码 :var
stream: TStringStream; s:string;begin
EditURL.Text :='http://www.cppinfo.com/pdm/business/site/cip/siteAppNo.jsp';
with IdHTTP do
begin
Request.Accept := 'image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-ms-application, application/x-ms-xbap,'
+ 'application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight, application/msword, */*';
Request.AcceptEncoding :='gzip, deflate';
Request.AcceptLanguage :='zh-cn';
Request.CacheControl :='no-cache';
Request.Connection :='Keep-Alive';
Request.ContentLength :=35;
Request.Host :='www.cppinfo.com';
Request.Referer :='http://www.cppinfo.com/pdm/business/site/cip/siteAppNo.jsp';
Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E)';
Request.ContentType := 'application/x-www-form-urlencoded';
HandleRedirects := true; AllowCookies :=true;
end;
stream:=TStringStream.Create('approveNo=2011075556&captchaNo='+edit2.Text); try try s:=IdHTTP.Post(EditURL.Text, stream );
Memo1.Clear ;
Memo1.Lines.Add(s ); except
ShowMessage('login fail');
end; finally
stream.Free ;
end;
end;是验证码不对还是 此网站有防护 不可以被模拟post
解决方案 »
- 急!求助,Delphi数据转发服务器设计!在线等待!
- 熟悉COM的近来看看吧,小的遇到问题向各位请教。
- ADOTable的问题?
- 请教:TPageProducer 形成文本为什么有时会少几个字符呢(如回车换行)?
- 在DLL中用globalalloc函数申请应用程序共享内存,实现多个应用程序共享数据!行不通!!
- 我的数据库中有一个完全格式的时间字段'2002-09-16 13:20:55' 可是在DBGrid中只显示2002-09-16,请问各位大侠如何才能将该字段显示完全
- 如果你不救我,我就完了!!!!!!
- 一个关于SQL查询结果引用的问题,在线等候
- Access violation at address 0047BCCC6 in module 'prj1.exe'.Read of address 00000
- 没有软驱怎么格式化硬盘!!!!!
- 打印条码时为何线不整齐?
- 关于DELPHI调试的问题
用WPE 截自己写的程序封包 再跟截浏览器的对比
这样容易找原因
Delphi7在使用idhttp的时候默认是不保存cookie的,要自己将获取验证码的cookie截取后然后
idhttp.request.customheaders.text:='cookie:' + COOKIE;
指定后再POST才可以!
INDY10直接GET验证码然后POST就可以了,不用指定COOKIE!
<FORM method=post name=cipForm target=_parent>
在父窗口打开 是不是 这里的问题 我搞不懂
HandleRedirects := true;也设置了
wpe 有毒呀
另外 我关联了 IdCookieManager1 post时肯定是带上了 cookie