怎样用idhttp实现对表单的post提交?请高手帮忙!(150分)

  • 主题发起人 主题发起人 Dusy
  • 开始时间 开始时间
D

Dusy

Unregistered / Unconfirmed
GUEST, unregistred user!
在Delphi7中,怎样用idhttp组件实现对表单的post提交?请高手帮忙!
例如:
<form method="post" action="http://www.tz-js.cn/yfex/ip/index.asp">
<td width="75%" align="center" height=22 bgcolor=#EFF1F3>
<input type="text" name="ip" size="22">
<input type="hidden" name="search" size="22" value="search">
<input type="submit" value="查 询" name="B1" c></td></form>
 
这个问题问太多次了,论坛里有,搜索一下
 
检索功能现在能用吗???????????[?]
 
procedure TForm1.SendPostData;
Var
aStream: TMemoryStream;
Params: TStringStream;
begin
aStream := TMemoryStream.create;
Params := TStringStream.create('');
HTTP.Request.ContentType := 'application/x-www-form-urlencoded';

try
Params.WriteString(URLEncode('sys_return_url=' + 'helo1' + '&'));
Params.WriteString(URLEncode('sys_return_url=' + 'helo2'));
with HTTP do begin
try
HTTP.Post('http://www.mydomain.com/postexampe.cgi', Params, aStream);
except
showmessage('Error encountered during POST ');
end;
end;
aStream.WriteBuffer(#0' ', 1);
showmessage(PChar(aStream.Memory));
except
end;
end;
 
调试后电脑提示Urlencode()函数没有声明,
还有HTTP.Request.ContentType := 'application/x-www-form-urlencoded'这个语句起什么作用.先谢谢了!![:)]
 
到这里看看http://www.delphibbs.com/delphibbs/dispq.asp?lid=2071973
 
后退
顶部