Link to home
Start Free TrialLog in
Avatar of arotton
arotton

asked on

TWebBrowser postdata

I need to open a new web page from a  program in delphi
 and send  post  login info
example postdata will be pass=pass login=login

WebBrowser1.OleObject.Navigate('http://xxxxxx.com/testme.php',1,'', postdata);

opens the page but sends no postdata
how is this done?
i am looking for any way in delphi to open a new browser and send the postdata



ASKER CERTIFIED SOLUTION
Avatar of 2266180
2266180
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arotton
arotton

ASKER

yes the link
 http://dn.codegear.com/article/26531
was what i am looking for
------
procedure TForm1.Button5Click(Sender: TObject);
var
  EncodedDataString: string;
  PostData: OleVariant;
  Headers: OleVariant;
  I: Integer;
begin
  // First, create a URL encoded string of the data
  EncodedDataString := 'login=login'  +   '&pass=sss'   ;

   // The PostData OleVariant needs to be an array of bytes as large
  // as the string (minus the NULL terminator)
  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;
  // Finally, we just Navigate to the URL. Note that you may have to modify
  // the path to your ASP page's location.
  WebBrowser1.Navigate('http://xxxxx.com/testme.php', 1,EmptyParam, PostData, Headers);
end;