RSS订阅 | 匿名投稿
您的位置:网站首页 > 网络 > 正文

Delphi下idHTTP配合CookieManager获取Cookie

作者:admin 来源: 日期:2018/4/6 13:44:38 人气: 标签:

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;


读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址:
下一篇:没有资料