Delphi Post登陆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.

相关阅读 >>

Delphi获取dos命令行输出函数 运行cmd命令并获取结果

Delphi 创建大窗口

Delphi idhttp1 获取网页代码

Delphi 从字符串中提取单词的函数

indy tidtcpclient 的一个用法上要留意的问题,以及 http

Delphi hextoint

在一个exe文件中查找指定内容,找到则返回起始位置,否则返回0

Delphi 文本转成图片

Delphi中操作powerpoint幻灯片的示例代码

Delphi idhttp1post上传图片

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...