Cookieを実行しようとして、Webサイトにログオンしています。私が理解していることから、IdCookieManagerをIdHTTPに割り当て、設定するだけで十分AllowCookies:=true
ですよね?ログイン後、Cookieを正常に受信しましたが、さらにナビゲートしようとすると、Cookieが送信されません。
これが私が持っているコードです:
procedure TForm1.Login;
var data: TStringList;
begin
data:=TStringList.Create;
try
IdHTTP.Get('http://navratdoreality.cz/'); // Here I receive Set-Cookie
data.Add('ACTION=check_adult');
data.Add('check=18plus');
Memo1.text:=IdHTTP.Post('http://navratdoreality.cz/',data); // Here the
// request contains the cookie and I get a succesfully-logged page in
// response, no more set-cookie
except
ShowMessage('err');
end;
data.Free;
end;
procedure TForm1.Navigate;
var ms:TMemoryStream;
begin
ms:=TMemoryStream.Create;
try
IdHTTP.Get('http://www.navratdoreality.cz/?p=view&id='+Edit1.Text, ms);
// the request doesn't contain any cookies, even though the cookie from
// logging is saved in IdCookieManager
ms.Position:=0;
Memo1.Lines.LoadFromStream(ms, TEncoding.UTF8);
except
ShowMessage('err');
end;
ms.Free;
end;
何が問題なのかわかりません。私のインディは10.5.8.0です。あなたがサイトを見るつもりなら、注意してください、それのいくつかはnsfwです。
ありがとう