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 2009 之 tstringbuilder 类[2]: append 与 appendformat

Delphi xe安装2010版控件

Delphi tfilestream 流操作2

Delphi 获取内网所有ip地址

Delphi 10进制数与33进制数的转换

Delphi webbrowser.oleobject属性

Delphi webbrowser通过遍历id查找元素是否存在

Delphi 执行控制台(console)程序获取返回结果

Delphi 实现程序放放多个进程条

Delphi case 语句中使用字符串

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



打赏

取消

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

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

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

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

评论

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