DELPHI中的代码,用BUTTON1触发procedure TForm1.Button1Click(Sender: TObject);
var
url:string ;
temp_response:Tstringstream;
temp:TStringList;
begin
temp_response:=Tstringstream.Create('');
try
temp:=TStringList.Create;
try
url:='http://192.168.1.41/test.asp';
temp.Add('title=hello,world');
//IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
idhttp1.Post(url,temp,temp_response);
memo1.Lines.Text:=temp_response.DataString;
temp.Free;
temp_response.Free;
except
application.MessageBox('correct happened!','wrong',MB_iconerror+MB_OK);
temp.Free;
close;
end;
except
application.MessageBox('correct happened!','wrong',MB_iconerror+MB_OK);
temp_response.Free;
close;
end;
end;
我想在ASP面页就是test.asp中显示出 temp.Add('title=hello,world')中的内容我在ASP面页中的代码如下:<body>
hello world!!
<form name="form1" method="post" action="test.asp"> <input name="title" type="text" id="title">
<input type="submit" name="Submit" value="提交">
<br>
<% response.Write("content is:"&request.Form("title")) %></form>
</body>----------------
我也是照着别人的例子来做的,在test.asp中没有显示出title的'hello,world'内容。
而在Delphi中的memo1可以显示整个test.asp的代码,其中content is: hello,world 有显示出来。我也不知道这样是不是发送成功?请大家指导一下,我该怎么写这个test.asp这边的代码可以使我要发送的内容在网页上显示出来。先谢过了大家啊。祝元旦快乐!!
var
url:string ;
temp_response:Tstringstream;
temp:TStringList;
begin
temp_response:=Tstringstream.Create('');
try
temp:=TStringList.Create;
try
url:='http://192.168.1.41/test.asp';
temp.Add('title=hello,world');
//IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
idhttp1.Post(url,temp,temp_response);
memo1.Lines.Text:=temp_response.DataString;
temp.Free;
temp_response.Free;
except
application.MessageBox('correct happened!','wrong',MB_iconerror+MB_OK);
temp.Free;
close;
end;
except
application.MessageBox('correct happened!','wrong',MB_iconerror+MB_OK);
temp_response.Free;
close;
end;
end;
我想在ASP面页就是test.asp中显示出 temp.Add('title=hello,world')中的内容我在ASP面页中的代码如下:<body>
hello world!!
<form name="form1" method="post" action="test.asp"> <input name="title" type="text" id="title">
<input type="submit" name="Submit" value="提交">
<br>
<% response.Write("content is:"&request.Form("title")) %></form>
</body>----------------
我也是照着别人的例子来做的,在test.asp中没有显示出title的'hello,world'内容。
而在Delphi中的memo1可以显示整个test.asp的代码,其中content is: hello,world 有显示出来。我也不知道这样是不是发送成功?请大家指导一下,我该怎么写这个test.asp这边的代码可以使我要发送的内容在网页上显示出来。先谢过了大家啊。祝元旦快乐!!
例用ClientSocket往你测试的http服务器发送如下内容即可:POST /test.asp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*
Referer: http://host.server.com/index.asp (一般是指向提交该内容的当前页的地址)
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: Host.server.com (服务器地址)
Content-Length: 17(由具体内容的长度决定)
Connection: close
Cache-Control: no-cachetitle=hello,world