//也可以用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;
pagename.asp?id=1&name=ccc 这种方式是get方式的?
idhttp.get()是获取网页数据的方法,而不是用get方式发送吧?
var
strResponse : string;
datastream: TIdMultiPartFormDataStream;
begin
datastream:= TIdMultiPartFormDataStream.Create;
datastream.AddFormField(’UserID’, EdtUser.text);
strResponse:=IdHTTP1.Post(URL.Text, data);
datastream.Free;
end; 这样试下
是不是这种方式,要看你设置的http头
//也可以用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;