Delphi WebBrowser1.Navigate Post 提交数据

procedure TForm1.Button1Click(Sender: TObject);
 var
postData:OleVariant;
vheader:OleVariant;
vflags:OleVariant;
vtargetFrame:OleVariant;
str :String;
i : integer;
begin
 str := 'message='
  + HTTPEncode('<message><request><serviceId>MIP_GET_APPT</serviceId><orgCode>1001</orgCode><sysId>HIS</sysId><operator>aaa</operator><date>2011-10-20 16:09:01</date></request>')
  + HTTPEncode('<body><apptInfo><beginDate>2012-09-10 00:00:00</beginDate><endDate>2012-09-11 08:00:00</endDate><cancelFlag>0</cancelFlag></apptInfo></body></message>');


 postData := VarArrayCreate([0,Length(str) - 1], varByte);
 for i := 1 to Length(str) do
   postData[i - 1] := Ord(str[i]);


 vheader := 'Content-Type: application/x-www-form-urlencoded' +  #10#13;
 vflags := 0;
 vtargetFrame := '';
 WebBrowser1.Navigate('http://172.16.2.69:8080/hispub?method=sendMessage',vflags,vtargetFrame,postData,vheader);
end;

你可能感兴趣的:(Delphi,N,WebBrowser)