我的delphi程序是这样的
procedure TForm1.bsSkinButton1Click(Sender: TObject);
var
list:TStringlist;
s:TStringStream;
str:string;
begin
list:=TStringlist.Create;
list.Add('user=李三);
s:=TStringStream.Create('');
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
self.IdHTTP1.Post('http://localhost/testdelphi.asp',list,s);
str:=s.ReadString(50);
showmessage(str);//此处的str总是为空
list.Free;
s.Free;
end;
我的ASP程序是这样的:
<%@ language="vbscript" codepage="936"%>
<% response.buffer=true %>
<html>
<head>
<title>login</title>
</head>
<body>
<%
Dim name,password
name=request.form("name")
response.write name & "你好,你的名字是" & name
%>
</body>
</html>
现在的问题是我的delphi程序怎样才能取得网页返回的值
procedure TForm1.bsSkinButton1Click(Sender: TObject);
var
list:TStringlist;
s:TStringStream;
str:string;
begin
list:=TStringlist.Create;
list.Add('user=李三);
s:=TStringStream.Create('');
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
self.IdHTTP1.Post('http://localhost/testdelphi.asp',list,s);
str:=s.ReadString(50);
showmessage(str);//此处的str总是为空
list.Free;
s.Free;
end;
我的ASP程序是这样的:
<%@ language="vbscript" codepage="936"%>
<% response.buffer=true %>
<html>
<head>
<title>login</title>
</head>
<body>
<%
Dim name,password
name=request.form("name")
response.write name & "你好,你的名字是" & name
%>
</body>
</html>
现在的问题是我的delphi程序怎样才能取得网页返回的值
解决方案 »
- ado 中 blob数据 字段 oldvalue 的问题
- 用delphi快一年了,连这个都不是太理解麻烦大家解答下!
- 如何获取当前日期以前的日期最近的记录,如果不存在则获取当前日期以后的日期最近的记录(急急急,送高分)?
- Delphi写的Webservices,IIS的应用保护设置?
- public变量定义在那?
- clientdataset控件问题
- 请问函数能返回一个动态数组吗?
- 用DLL作MDI子窗,在主窗口关闭时如何确保所有的子窗口已关闭!
- TEXT和CAPTION有区别吗?COMBOBOX控件有CAPTION属性吗?谢谢~
- 奇怪的浏览器问题
- 做一个监控打印机的程序,要求得到打印的时间,内容,份数,,,高手请指点。
- 大侠帮我分析一下
Microsoft XML Core Services (MSXML) 4.0 - DOM Reference See Also
IXMLHTTPRequest | IServerXMLHTTPRequest/ServerXMLHttp Members
Requirements
Supported platforms include Microsoft Windows® 2000, or Microsoft Windows NT® 4.0 with Microsoft Internet Explorer 5.01 (or later) installed. ServerXMLHTTP fails on other platforms, such as Microsoft Windows 98.Implementation: msxml4.dll, msxml2.lib
Language
C/C++Show All
IServerXMLHTTPRequest/ServerXMLHTTP
Provides methods and properties that enable you to establish an HTTP connection between files or objects on different Web servers.The ServerXMLHTTP object offers functionality similar to that of the XMLHTTP object. Unlike XMLHTTP, however, the ServerXMLHTTP object does not rely on the WinInet control for HTTP access to remote XML documents. ServerXMLHTTP uses a new HTTP client stack. Designed for server applications, this server-safe subset of WinInet offers the following advantages: Reliability — The HTTP client stack offers longer uptimes. WinInet features that are not critical for server applications, such as URL caching, auto-discovery of proxy servers, HTTP/1.1 chunking, offline support, and support for Gopher and FTP protocols are not included in the new HTTP subset.
Security — The HTTP client stack does not allow a user-specific state to be shared with another user's session. ServerXMLHTTP provides support for client certificates.
Note For more information about the limitations of the WinInet control, see WinInet Limits Connections Per Server.
Usage
The ServerXMLHTTP object is commonly used to: Receive XML documents from an Active Server Pages (ASP) page on a local or remote Web server (HTTP GET).
Post XML documents to an ASP page on a local or remote Web server (HTTP POST).
Post and process response XML documents from an ASP page (HTTP POST).
You can use the ServerXMLHTTP object either indirectly using the setProperty method of DOMDocument or directly using the ServerXMLHTTP object itself. For examples of these two approaches, as well as examples of how to use the ServerXMLHTTP security options and how to use ServerXMLHTTP in a multitiered environment, see IServerXMLHTTPRequest/ServerXMLHTTP Examples.Res
The ServerXMLHTTP open method makes the connection between servers and the send method sends the request.You can read the response using one of the four following properties: responseBody, responseStream, responseText, and responseXML.[C/C++]
With ServerXMLHTTP, the usual sequence is to call the open method, set any custom header information through the setRequestHeader method, call the send method, and then check one of the four response properties.For example, an ASP, Microsoft® Visual Basic®, or C++ component on a server computer can send an HTTP request to another server and then receive the response as a stream or XML document object. The response can then be fed to downstream clients, saved to a file on the server, or combined with other XML data (potentially collected from other Web servers).ServerXMLHTTP offers additional benefits for transporting XML data: ServerXMLHTTP maintains state, so transactional XML data can be used in business applications that require real-time responses.
ServerXMLHTTP allows you to serve the response object as a stream or Document Object Model (DOM) object. As a stream, this offers considerable performance benefits when moving data through the HTTP protocol.
ServerXMLHTTP offers backward compatibility with XMLHTTP. Source code (JScript, Visual Basic Scripting Edition, Visual Basic, or C++) that uses the XMLHTTP component can be easily modified to use the new ServerXMLHTTP component.The number of instances of ServerXMLHTTP that can exist simultaneously within a single process primarily depends upon the amount of memory available for applications on the system. However, other factors, such as CPU processing capacity, or available socket connections can further limit the number of instances that can be active simultaneously.The IServerXMLHTTPRequest interface inherits from IXMLHTTPRequest and extends it with the following four new methods: getOption, setOption, waitForResponse, and setTimeouts.Requirements
Supported platforms include Microsoft Windows® 2000, or Microsoft Windows NT® 4.0 with Microsoft Internet Explorer 5.01 (or later) installed. ServerXMLHTTP fails on other platforms, such as Microsoft Windows 98.Implementation: msxml4.dll, msxml2.lib[C/C++]
Header and IDL files: msxml2.h, msxml2.idlVersion-Dependent ProgID: Msxml2.ServerXMLHTTP.4.0Version-Dependent CLSID: 88D969C6-F192-11D4-A65F-0040963251E5See Also
IXMLHTTPRequest | IServerXMLHTTPRequest/ServerXMLHttp Members
response.write (request.querystring("name"))
此时网页就只输出edit1.text中的内容然后你用Edit2.text = IdHTTP1.open('http://localhost/testdelphi.asp?name=' + edit1.text;
即可获得这一行(多行数据用memo)数据,按照这个思路就OK!我作过的,可能代码写错的但是思路绝对如此!