DELPHI关于获取COOKIE的编程问题
来源:百度知道 编辑:UC知道 时间:2024/05/22 00:05:32
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, IdCookieManager;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
IdHTTP1: TIdHTTP;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
IdCookieManager1: TIdCookieManager;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetRandomPassword(ALen: Integer): string;
var
str: string;
begin
Randomize;
str := '1234567890abcdefghijklmnopqrstuvwxyz';
Result := '';
repeat
Result := Res
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, IdCookieManager;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
IdHTTP1: TIdHTTP;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
IdCookieManager1: TIdCookieManager;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetRandomPassword(ALen: Integer): string;
var
str: string;
begin
Randomize;
str := '1234567890abcdefghijklmnopqrstuvwxyz';
Result := '';
repeat
Result := Res
idhttp1.POST('http://passport.donews.com/login',dl);
dhttp1.get('http://hi.donews.com/vote.jsp?id='+ EdIt2.TEXT);
两个url不一样,cookie 内容也不一样。
也就是说 cookie 是跟url邦定的