Solved

TWebBrowser postdata

Posted on 2008-10-16
2
1,110 Views
Last Modified: 2012-06-27
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



0
Comment
Question by:arotton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Accepted Solution

by:
2266180 earned 500 total points
ID: 22733714
here are some link explaining and showing how it's done via IE:
with twebbrowser: http://dn.codegear.com/article/26531
with url api: http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_21249531.html
and uploading files too: http://delphi.about.com/od/delphitips2007/qt/httppost_delphi.htm

and using indy, you can find some on my site. they are specifically persistent login examples in various sites. the idea with indy is that you need to manage cookies by yourself, somthing IE does automatically for you ;) but if you don't need the overhead of IE, then indy can be a solution:
http://www.ciuly.com/delphi/indy/
0
 

Author Comment

by:arotton
ID: 22734899
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;

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month4 days, 3 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question