A
abencat
Unregistered / Unconfirmed
GUEST, unregistred user!
//运行通过没有错误 可是就是不能发表留言内容
//???????????????
procedure TForm1.Button3Click(Sender: TObject);
function makediy():string;
var
IdHTTP: TIDHttp;
myParams:tStringList;
ret:TStringStream;
S,Cookie:string;
i: integer;
begin
IdHTTP := TIDHttp.Create(nil);
IdHTTP.ReadTimeout := 30*1000;
ret:=tstringstream.Create('');
myParams:=tStringList.Create;
S := IdHttp.Get('http://localhost/webb/book.asp?action=Add_New');
Memo1.Text := S;
// 从返回的页面中找出cookie, 并增加到http.Request中
for i := 0 to IdHttp1.Response.RawHeaders.Count -1 do
if UpperCase(LeftStr(IdHttp1.Response.RawHeaders, 10)) = 'SET-COOKIE' then
begin
Cookie := Trim(Copy(IdHttp1.Response.RawHeaders, 12, MaxInt));
Cookie := Copy(Cookie, 1, Pos(';', Cookie) - 1);
IdHttp.Request.RawHeaders.Add('Cookie:'+ Cookie);
end;
myParams.Add('name=标题容');
myParams.Add('SEX=0');
myParams.Add('email=');
myParams.Add('qq=11112');
myParams.Add('web=www.163.com');
myParams.Add('city=11111');
myParams.Add('title=1');
myParams.Add('words=内容士大夫士大夫');
myParams.Add('admin=0');
myParams.Add('comeurl=http://localhost/webb/book.asp?action=Add_New');
myParams.Add('Submit=提交');
try
IdHTTP.HTTPOptions:=[];
IdHttp.Post('http://localhost/webb/book.asp?Add_New_Execute',myParams,ret);
//IdHTTP.Post('http://localhost/asp/ac.asp',myParams,ret);
Ret.Position:=0;
form1.Memo1.Lines.LoadFromStream(ret);
finally
IdHTTP.Disconnect;
FreeAndNil(IdHTTP);
FreeAndNil(myParams);
end;
end;
begin
makediy();
end;
//???????????????
procedure TForm1.Button3Click(Sender: TObject);
function makediy():string;
var
IdHTTP: TIDHttp;
myParams:tStringList;
ret:TStringStream;
S,Cookie:string;
i: integer;
begin
IdHTTP := TIDHttp.Create(nil);
IdHTTP.ReadTimeout := 30*1000;
ret:=tstringstream.Create('');
myParams:=tStringList.Create;
S := IdHttp.Get('http://localhost/webb/book.asp?action=Add_New');
Memo1.Text := S;
// 从返回的页面中找出cookie, 并增加到http.Request中
for i := 0 to IdHttp1.Response.RawHeaders.Count -1 do
if UpperCase(LeftStr(IdHttp1.Response.RawHeaders, 10)) = 'SET-COOKIE' then
begin
Cookie := Trim(Copy(IdHttp1.Response.RawHeaders, 12, MaxInt));
Cookie := Copy(Cookie, 1, Pos(';', Cookie) - 1);
IdHttp.Request.RawHeaders.Add('Cookie:'+ Cookie);
end;
myParams.Add('name=标题容');
myParams.Add('SEX=0');
myParams.Add('email=');
myParams.Add('qq=11112');
myParams.Add('web=www.163.com');
myParams.Add('city=11111');
myParams.Add('title=1');
myParams.Add('words=内容士大夫士大夫');
myParams.Add('admin=0');
myParams.Add('comeurl=http://localhost/webb/book.asp?action=Add_New');
myParams.Add('Submit=提交');
try
IdHTTP.HTTPOptions:=[];
IdHttp.Post('http://localhost/webb/book.asp?Add_New_Execute',myParams,ret);
//IdHTTP.Post('http://localhost/asp/ac.asp',myParams,ret);
Ret.Position:=0;
form1.Memo1.Lines.LoadFromStream(ret);
finally
IdHTTP.Disconnect;
FreeAndNil(IdHTTP);
FreeAndNil(myParams);
end;
end;
begin
makediy();
end;