
01.08.2011, 20:02
|
Прохожий
|
|
Регистрация: 01.08.2011
Сообщения: 1
Репутация: 10
|
|
тоже возникла проблема с куками. сайт их передает, но они не записываются.
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdCookieManager, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdAntiFreezeBase, IdAntiFreeze, IdHTTP, IdHTTPEx;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
IdHTTP1: TIdHTTP;
IdCookieManager1: TIdCookieManager;
IdAntiFreeze1: TIdAntiFreeze;
Button2: TButton;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
http: TIdHTTPEx;
CM : TidCookieManager;
Data : TStringList;
StrPage, s: String;
i,y : integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
try
http := TIdHTTPEx.Create(self);
Data := TStringList.Create;
CM := TidCookieManager.Create(Http);
Http.AllowCookies := true;
Http.CookieManager := CM;
Http.HandleRedirects := true;
HTTP.RedirectMaximum:=2;
Http.Request.Host:='murclub.ru';
Http.Request.UserAgent:='Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10';
Http.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
Http.Request.AcceptLanguage:='ru,en-us;q=0.7,en;q=0.3';
Http.Request.AcceptEncoding:='gzip, deflate';
Http.Request.AcceptCharSet:='windows-1251,utf-8;q=0.7,*;q=0.7';
Http.Request.Connection:='keep-alive';
Http.Request.Referer:='http://murclub.ru/index.php';
Http.Request.ContentType:='application/x-www-form-urlencoded';
Data.Add('login=***');
Data.Add('password=***');
Data.Add('hop=1');
StrPage := Http.PostEx('http://murclub.ru/index.php', Data);
s:= HTTP.Response.RawHeaders.text
finally
Data.Free;
CM.Free;
Http.Free;
end;
if Pos('http://swf.murclub.ru/flash/chatpreloader.swf',StrPage) <> 0 then
ShowMessage('Àâòîðèçàöèÿ ïðîøëà óñïåøíî')
else
ShowMessage('Àâòîðèçàöèÿ ïðîâàëèëàñü');
Memo1.Lines.Text := StrPage;
Memo2.Lines.Text := s;
end;
end.
вот мой код, подскажите, возможно чего-то не хватает тут
|