asp接收post过来的数据方法是:
<%
name=trim(request.form("name"))
password=trim(request.form("password"))
response.Write (name&"<br>"&password)
%>delphi如何实现这个功能呢,
接收post过来的name和password,并showmessage显示出来

解决方案 »

  1.   

    用Delphi编写HTTP服务器?还是用Delphi写CGI?
      

  2.   

    用Delphi编写的HTTP服务器,有人知道吗,帮助一下.
    只要能接收到post过来的数据并显示就可以了,
      

  3.   

    这个不是那么容易的,建议自己去了解一下HTTP协议相关的RFC文档。
    比如你可以得到HTTP请求当中的HttpData,然后根据&分解,就可以得到Name=YourName之类的信息,用StringList分解就是了。当然需要注意一些百分号(%)打头的转义字符。
      

  4.   


    可以使用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.