Delphi Post Delphi 상자 포럼 소스에 로그인

6636 단어 Delphi
unit Unit1;



interface



uses

  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,

  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Buttons, Vcl.OleCtrls, SHDocVw,

  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,

  Vcl.StdCtrls;



type

  TForm1 = class(TForm)

    SpeedButton1: TSpeedButton;

    IdHTTP1: TIdHTTP;

    Memo1: TMemo;

    Edit1: TEdit;

    Edit2: TEdit;

    Edit3: TEdit;

    procedure SpeedButton1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;



var

  Form1: TForm1;



implementation



{$R *.dfm}



procedure TForm1.SpeedButton1Click(Sender: TObject);

Var

  cCon:TSTringList;

  cSTR,cText:TStringStream;

  i:Integer;

  TempHTTP:TIDHTTP;

begin

 IdHTTP1:=TIDHTTP.Create(nil);

 TempHTTP:=TIDHTTP.Create(nil);

 cCon:=TStringList.Create;

 IDHTTP1.HandleRedirects:=True;

 TempHTTP.HandleRedirects:=True;

 cText:=TStringStream.Create;

 IDHTTP1.Request.Accept:='image/gif, image/jpeg, image/pjpeg, image/pjpeg,application/x-shockwave-flash, application/vnd.ms-excel, ';

 IDHTTP1.Request.Accept:=IDHTTP1.Request.Accept+'application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*';

 IDHTTP1.Request.Referer:='http://bbs.2ccc.com/default.asp';

 IDHTTP1.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)';

 IDHTTP1.Request.ContentType:='application/x-www-form-urlencoded';

 IDHTTP1.Request.AcceptEncoding:='gzip, deflate';

 IDHTTP1.Request.Host:='bbs.2ccc.com';

 IDHTTP1.Request.CacheControl := 'no-cache';

 idhttp1.Request.Connection := 'Keep-Alive';

 cCon.Add('membername='+Trim(Edit1.Text));

 cCon.Add('memberpass='+Trim(Edit2.Text));

 cCon.Add('act=1');

 IDHTTP1.Post('http://bbs.2ccc.com/login.asp',cCon,cText);

// Edit3.Text:=IDHTTP1.Response.RawHeaders.Text;

 for i := 0 to IDHTTP1.CookieManager.CookieCollection.Count-1 do

    Edit3.Text:=Edit3.Text+IDHTTP1.CookieManager.CookieCollection.Cookies[i].Value;

 //IDHTTP1.GET('http://bbs.2ccc.com/',cText);

 TempHTTP.Get('http://bbs.2ccc.com/',cText);

 Memo1.Text:=cText.DataString;

 cText.Free;

end;



end.

좋은 웹페이지 즐겨찾기