求idhttp post例子

w452170906 2012-12-14 07:01:46
找了半天没有post例子,谁能发个,小弟学习下!!!

小弟感激不尽啊!!!
...全文
107 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sololie 2012-12-14
  • 打赏
  • 举报
回复
不是自带有demo源码嘛。。。
OO_is_just_P 2012-12-14
  • 打赏
  • 举报
回复
这个Indy都是自己创建的,退出登录同时释放之~
OO_is_just_P 2012-12-14
  • 打赏
  • 举报
回复
function Login(const Username,Password: string): Boolean; var html :string; begin Result :=False; Account :=UserName; IndyHttp :=TIdHTTP.Create(nil); IndyCookieManager :=TIdCookieManager.Create(nil); IndyHttp.CookieManager :=IndyCookieManager; IndyZlib :=TIdCompressorZLibEx.Create(nil); IndyHttp.Compressor :=IndyZlib; PostParams :=TStringList.Create; IndyHttp.Request.CacheControl :='no-cache'; IndyHttp.Request.Connection :='Keep-Alive'; IndyHttp.Request.Accept :='text/html, application/xhtml+xml, */*'; IndyHttp.Request.ContentType :='application/x-www-form-urlencoded'; IndyHttp.HandleRedirects :=True; IndyHttp.AllowCookies :=True; IndyHttp.HTTPOptions :=[hoForceEncodeParams]; IndyHttp.Get('http://192.168.0.1/Default.aspx'); PostParams.Clear; PostParams.Add('account='+Username); PostParams.Add('password='+Password); IndyHttp.Request.Referer :='Referer http://192.168.0.1/Default.aspx'; html :=IndyHttp.Post('http://192.168.0.1/Login.ashx',PostParams); if Pos('{Userinfo:[{result:"1"}]}',html)>0 then //ajax Result :=True; end;
w452170906 2012-12-14
  • 打赏
  • 举报
回复
就是网站登录的例子....

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧