如何才能让delphi用post方式向网页发送数据!

ccwangliqun 2009-06-01 12:58:45
刚刚学会delphi用get方式向网页发送数据,不知道如何用post方式发送呢?
...全文
937 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccwangliqun 2009-06-05
  • 打赏
  • 举报
回复
请问8楼的兄弟,如何才能idhttp.post()的发送方式,让他分别使用get、post、multipart/form-data格式?
hzcenter 2009-06-03
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 ccwangliqun 的回复:]
明白了,idhttp.post()的确是post方式,但是不是multipart/form-data的表单数据。
[/Quote]

是不是这种方式,要看你设置的http头
liangpei2008 2009-06-03
  • 打赏
  • 举报
回复

//也可以用com来发
function TForm1.GetData(url:string): string;
var
responseText: WideString;
xmlHttp: oleVariant;
begin
Result:='';
try
xmlHttp:=CreateOleObject('Msxml2.XMLHTTP');
xmlHttp.open('POST',url,false);
xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlHttp.send('ePayAccountNum=XXX&password=XXX&transactionCode=XXX&orderNum=IVC00544&transactionAmount=10.00&cardAccountNum=XXX&expirationDate=0108&testTransaction=Y');
responseText:=xmlHttp.responseText;
if xmlHttp.status='200' then
begin
Result:=responseText;
end;
xmlHttp := Unassigned;
except
Result:='';
end;
end;
ccwangliqun 2009-06-02
  • 打赏
  • 举报
回复
明白了,idhttp.post()的确是post方式,但是不是multipart/form-data的表单数据。
ccwangliqun 2009-06-02
  • 打赏
  • 举报
回复
TIdMultiPartFormDataStream 需要引用那个单元啊?
shuihan20e 2009-06-01
  • 打赏
  • 举报
回复

var
strResponse : string;
datastream: TIdMultiPartFormDataStream;
begin
datastream:= TIdMultiPartFormDataStream.Create;
datastream.AddFormField(’UserID’, EdtUser.text);
strResponse:=IdHTTP1.Post(URL.Text, data);
datastream.Free;
end;

这样试下
shuihan20e 2009-06-01
  • 打赏
  • 举报
回复
idhttp.post不是post方式吧
ccwangliqun 2009-06-01
  • 打赏
  • 举报
回复
是不是idHttp.Post();发送的都是post方式的?
pagename.asp?id=1&name=ccc 这种方式是get方式的?
idhttp.get()是获取网页数据的方法,而不是用get方式发送吧?
sxy_9761 2009-06-01
  • 打赏
  • 举报
回复
idHttp.Post();
hzcenter 2009-06-01
  • 打赏
  • 举报
回复
用了什么控件?还是??

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧