Delphi下idHTTP配合CookieManager获取Cookie


本文整理自网络,侵删。

 
procedure TForm1.Button1Click(Sender: TObject);
var
  Cookies: TidCookies;
  i: integer;
begin
  Memo1.Clear;
  idHTTP1.ProtocolVersion := pv1_1;
  Memo1.Clear;
  IdHTTP1.ProtocolVersion := pv1_1;
  IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)';
  idHTTP1.Get('http://www.baidu.com/s?wd=xtty');
  ShowMessage(idHTTP1.URL.Params);
  ShowMessage(idHTTP1.URL.Document);

  Cookies := IdCookieManager1.CookieCollection;
  for i := 0 to cookies.Count - 1 do
    Memo1.Lines.Add(Cookies.Items[i].CookieName + 'Value:' + Cookies.Items[i].Value);
end;

相关阅读 >>

Delphi windows 编程[18] - 更换菜单项: modifymenu

Delphi的goto语句

Delphi 修改exe应用程序图标

Delphi使用ixmlhttprequest 简单获取网页源代码

Delphi richedit文字背景色的处理

Delphi2010的操作界面切换到Delphi7的操作模式

Delphi xe7中stringgrid组件的使用

Delphi combobox和listbox的文字可以右对齐显示

Delphi indy 10.5.7的数据发送接收的用法

Delphi playsound(); 停止播放

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...