asp接收post过来的数据方法是:
<%
name=trim(request.form("name"))
password=trim(request.form("password"))
response.Write (name&"<br>"&password)
%>delphi如何实现这个功能呢,
接收post过来的name和password,并showmessage显示出来
<%
name=trim(request.form("name"))
password=trim(request.form("password"))
response.Write (name&"<br>"&password)
%>delphi如何实现这个功能呢,
接收post过来的name和password,并showmessage显示出来
解决方案 »
- 请教一个D7写的DLL,调用出现Stack OverFlow的问题,谢谢!
- 问一个FastReport很简单的问题
- report machine 套打如何实现?
- 第一份工资到手,散分啊......
- 一个简单的关于Unit的问题,但是很急!
- dbcombobox的style為csdropdownlist時的問題
- 100分寻找条码打印的解决方案
- 关于fast report2.47的问题。
- 表的问题!(给分)
- 一个非常奇怪的问题!——我将IMAGE中的图象保存到数据库中,但是程序每启动一次只能成功存储一幅图,其余的都变花了,很难看,这是怎么回事???!!!
- 求助 access导入access 代码 (在线等)
- dll 封装对象的疑问
只要能接收到post过来的数据并显示就可以了,
比如你可以得到HTTP请求当中的HttpData,然后根据&分解,就可以得到Name=YourName之类的信息,用StringList分解就是了。当然需要注意一些百分号(%)打头的转义字符。
可以使用indyhttpserver建立一个http server
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdCustomHTTPServer,
IdHTTPServer,Comobj, StdCtrls, Buttons;type
TForm1 = class(TForm)
IdHTTPServer1: TIdHTTPServer;
cmdPost: TBitBtn;
ListBox1: TListBox;
procedure IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo);
procedure FormCreate(Sender: TObject);
procedure cmdPostClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
with AThread.Connection do
begin
//
if ARequestInfo.Command = 'POST' then //解析post过来的数据
begin
listbox1.Items.Add('name is: '+ARequestInfo.Params.Values['name']);
listbox1.Items.Add('password is: '+ARequestInfo.Params.Values['password']);
end;
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
self.IdHTTPServer1.DefaultPort:=8009; //绑定http端口
self.IdHTTPServer1.Active:=true;
end;//-----调用
procedure TForm1.cmdPostClick(Sender: TObject);
var
url:string;
xmlHttp:Olevariant;
responseText:Widestring;
begin
//发送测试数据
url:='http://127.0.0.1:8009/?name=1&password=23232ddsdsds';
try
xmlHttp:=CreateOleObject('Msxml2.XMLHTTP');
xmlHttp.open('POST',url,false);
xmlHttp.send('111111----111111');
responseText:=xmlHttp.responseText;
if xmlHttp.status='200' then
begin
//--
end
else
begin
//--
end;
except
On E:Exception do
//--
showmessage(e.Message);
end;
end;end.