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;


联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678