delphi webbrowser post自动登录

delphi webbrowser post自动登录  

 

 
 
var
  EncodedDataString: WideString;
  PostData: OleVariant;
  Headers: OleVariant;
  I: Integer;
begin

  // 创建提交串
  EncodedDataString := 'waybills='+HTTPEncode(edtshippingsn.Text)+'&'+'verifycode=' + HTTPEncode(edtcode.Text);

  // 创建字节方式的可变变量数组,并将字符串转换之。
  PostData := VarArrayCreate([0, Length(EncodedDataString) - 1], varByte);
  // Now, move the Ordinal value of the character into the PostData array
  for I := 1 to Length(EncodedDataString) do
      PostData[I-1] := Ord(EncodedDataString[I]);

  // 头类型
  Headers := 'Content-Type: application/x-www-form-urlencoded' + #10#13;

  // 提交
  wb1.Navigate('http://www.exp.com/myquery/queryBill.action?locale=zh_CN', EmptyParam,
      EmptyParam, PostData, Headers);

end;

你可能感兴趣的:(WebBrowser)