怖客-致力于对网络技术的研究!

delphi 论坛自动登录器实例

自行添加内容

使用了IDHTTP,用POST提交数据

var
   strMsg:string;
   sParams: TStringStream; //用来保存文本
begin
sParams := TStringStream.create(''); //文本为空
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; //请求
try
    sParams.WriteString('参数1=结果&参数2=结果2') ; //填冲文本
    strMsg:=IdHTTP1.post('http://www.bkhack.com /add-c.asp',sParams) ; //向网址发
    memo1.Text:=strmsg; // memo1显示结果
finally
    sParams.Free ;    //结束
end;

//取Cookie
s := 'http://aaa.net/bbs/index.php';        //网址
if CanGetIECookie(s, str) then
begin
    CookieStr := 'Cookie: ' + str;
    idHttp1.Request.CustomHeaders.Text := CookieStr;
end else
begin
    ShowMessage('没有发现本地Cookie,请从Web页面登陆一次。');
    Exit;
end;
s := 'http://www.topjishu.com/forum.php';
PostData := TStringList.Create;
PostData.Add('fid=1');
Memo1.Lines.Text := idHTTP1.Post(s, PostData);
PostData.Free;

//提交用户密码
var
S:TStringList;
begin
S := TStringList.Create;
S.Add('user=', edtUser.text);
S.Add('pass=', edtPass.text);
try
    HTTP.Post('http://www.bkhack.com/', S);
finally
    HTTP.Free;
end;
end;

自行添加内容
标签:delphi
分类:编程教程| 发布:lxsky| 查看: | 发表时间:2011-12-25
原创文章如转载,请注明:转载自怖客,delphi教程,socket编程,vc 教程,电脑技术培训,网络安全 http://www.bkhack.com/
本文链接:http://www.bkhack.com/biancheng/delphi-LunTanZiDongDengLuQiShiLi.html

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

自行添加内容