【发布时间】:2015-09-26 05:50:11
【问题描述】:
我想让一个程序自动访问这个网站http://ringzer0team.com/ 我需要的一切(用户,通行证,csfr)我有,但是如何保持HTTP - 连接在帕斯卡?我使用http://posttestserver.com/ 来测试帖子的方法。 这是我的代码。当我检查 login.html 文件时。它说 HTTP_CONNECTION = close 所以我想知道如何保持它。
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,StdCtrls, httpsend,synacode;
procedure TForm1.Button2Click(Sender: TObject);
var
URL: string;
Params: string;
Response: TMemoryStream;
i:longint;
S:ansistring;
cs:string;
begin
httpClient:= THTTPSend.Create;
if httpClient.HTTPMethod('GET', 'http://ringzer0team.com/login') then
httpClient.Document.SaveToFile('1.txt');
httpClient.Free;
system.assign(fi,'1.txt');
reset(fi);
for i:=1 to 62 do readln(fi,S);
cs:=copy(S,21,32);
system.close(fi);
Response := TMemoryStream.Create;
try
URL := 'http://posttestserver.com/post.php?dump&html';
Params := 'username=' + EncodeURLElement('user') + '&' + 'password=' + EncodeURLElement('pass') + '&' + 'csrf=' + EncodeURLElement(cs);
system.assign(fi,'text');
if HttpPostURL(URL, Params, Response) then Response.SaveToFile('login.html');
finally
Response.Free;
end;
end;
【问题讨论】:
标签: freepascal lazarus httpconnection synapse