我是要把信息POST到一个留言版上,但对ASP的留言板未能成功!下面是我的代码。
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Psock, NMHttp, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Memo2: TMemo;
NMHTTP1: TNMHTTP;
procedure Button1Click(Sender: TObject);
procedure NMHTTP1Success(Cmd: CmdType);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
With NMHTTP1 do
Begin
InputFileMode :=False;
OutputFileMode :=False;
ReportLevel :=Status_Basic;
end;
With NMHTTP1.HeaderInfo do
begin
Cookie :='';
LocalMailAddress :='';
LocalProgram :='';
Referer :='';
UserID :='';
Password :='';
try
NMHTTP1.Post('http://www.shu163.com/freebook2/savebook.asp?','name=匆匆过客&[email protected]&ly=asdfsdsf&Submit=提交留言&Submit2=重新填写');
except
showMessage(' Error! ');
end;
End;
end;procedure TForm1.NMHTTP1Success(Cmd: CmdType);
begin
Memo1.Text := NMHTTP1.Header;
Memo2.Text := NMHTTP1.Body;
end;end.
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Psock, NMHttp, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Memo2: TMemo;
NMHTTP1: TNMHTTP;
procedure Button1Click(Sender: TObject);
procedure NMHTTP1Success(Cmd: CmdType);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
With NMHTTP1 do
Begin
InputFileMode :=False;
OutputFileMode :=False;
ReportLevel :=Status_Basic;
end;
With NMHTTP1.HeaderInfo do
begin
Cookie :='';
LocalMailAddress :='';
LocalProgram :='';
Referer :='';
UserID :='';
Password :='';
try
NMHTTP1.Post('http://www.shu163.com/freebook2/savebook.asp?','name=匆匆过客&[email protected]&ly=asdfsdsf&Submit=提交留言&Submit2=重新填写');
except
showMessage(' Error! ');
end;
End;
end;procedure TForm1.NMHTTP1Success(Cmd: CmdType);
begin
Memo1.Text := NMHTTP1.Header;
Memo2.Text := NMHTTP1.Body;
end;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货