Board index » delphi » Posting data to forms

Posting data to forms


2003-08-08 04:30:28 PM
delphi158
Hi,
Id like to know if its possible to have an application fill an online form with data and post it as well. The form posts data via cgi. If so how ?
Thanks and regards
 
 

Re:Posting data to forms

Quote
Id like to know if its possible to have an application fill an online form
with data and post it as well. The form posts data via cgi. If so how ?
You can do it easily with ICS. Use the HTTP client component to do exactly
what a browser do when submitting a form (Post or Get method). If you need
help, please use ICS support mailing list where a team will answer your
questions and about 1000 subscribers wshare their experience with ICS.
Download ICS full source code from www.overbyte.be
--
Contribute to the SSL Effort. Visit
overbyte.delphicenter.com/eng/ssl.html
 

Re:Posting data to forms

Hi Francois,
I already am using Indy 9. Is it not possible with Indy? If not then I will try ICS.
Thanks and Regards
"Francois PIETTE" <XXXX@XXXXX.COM>writes:
Quote
>Id like to know if its possible to have an application fill an online form
>with data and post it as well. The form posts data via cgi. If so how ?

You can do it easily with ICS. Use the HTTP client component to do exactly
what a browser do when submitting a form (Post or Get method). If you need
help, please use ICS support mailing list where a team will answer your
questions and about 1000 subscribers wshare their experience with ICS.
Download ICS full source code from www.overbyte.be

--
Contribute to the SSL Effort. Visit
overbyte.delphicenter.com/eng/ssl.html
--
XXXX@XXXXX.COM
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
www.overbyte.be



 

Re:Posting data to forms

Quote
Hi Francois,

I already am using Indy 9. Is it not possible with Indy? If not then i'll
try ICS.

I don't see why you couldn't do this with INDY.
Off the top of my head I'd do something like the following:
First do a HTTP GET to retrieve the HTML form you want to fill in.
Then parse the HTML form and figure out what you need to fill in and fill it
in.
Then do a HTTP POST and submit the HTML form that you just parsed and filled
in to the appropriate place.
All of this can be done using the INDY HTTP client.
 

Re:Posting data to forms

"doesnotmatter" <XXXX@XXXXX.COM>writes
Quote
I already am using Indy 9. Is it not possible with Indy?
Yes, of course it is possible with Indy. TIdHTTP has a Post() method which
can accept post data. Have a look at the TIdMultiPartFormDataStream class.
Gambit
 

Re:Posting data to forms

Hello,
Ok, the form has a few fields like "edit1", "edit2" ...etc and a submit button: "button1". The form is named "TrialForm" and the submit action is linked to a cgi script.
So using idHTTP how can i get along this ?
"Remy Lebeau \(TeamB\)" <XXXX@XXXXX.COM>writes:
Quote

"doesnotmatter" <XXXX@XXXXX.COM>writes
news:3f3383bb$XXXX@XXXXX.COM...

>I already am using Indy 9. Is it not possible with Indy?

Yes, of course it is possible with Indy. TIdHTTP has a Post() method which
can accept post data. Have a look at the TIdMultiPartFormDataStream class.


Gambit


 

Re:Posting data to forms

"doesnotmatter" <XXXX@XXXXX.COM>writes
Quote
Ok, the form has a few fields like "edit1", "edit2" ...etc
and a submit button: "button1". The form is named
"TrialForm" and the submit action is linked to a cgi script.
So using idHTTP how can i get along this ?
Assuming the following HTML:
<form name="TrialForm" action="www.somesite.com/somescript.cgi"
method="post">
<input type="text" name="edit1">
<input type="text" name="edit2">
<input type="submit">
</form>
You would do the following with Indy:
var
PostData: TIdMultiPartFormDataStream;
Result: String;
PostData := TIdMultiPartFormDataStream.Create;
try
PostData.AddFormField("edit1", "TextFromEdit1");
PostData.AddFormField("edit2", "TextFromEdit2");
Result := IdHTTP.Post("www.somesite.com/somescript.cgi",
PostData);
finally
PostData.Free;
end;
Parsing out the values from the HTML is your own responsibility separately.
Indy has no facilities for handling that.
Gambit
 

Re:Posting data to forms

Thank you. Ill try this.
Regards
"Remy Lebeau \(TeamB\)" <XXXX@XXXXX.COM>writes:
Quote

"doesnotmatter" <XXXX@XXXXX.COM>writes
news:3f340104$XXXX@XXXXX.COM...

>Ok, the form has a few fields like "edit1", "edit2" ...etc
>and a submit button: "button1". The form is named
>"TrialForm" and the submit action is linked to a cgi script.
>So using idHTTP how can i get along this ?

Assuming the following HTML:

<form name="TrialForm" action="www.somesite.com/somescript.cgi"
method="post">
<input type="text" name="edit1">
<input type="text" name="edit2">
<input type="submit">
</form>

You would do the following with Indy:

var
PostData: TIdMultiPartFormDataStream;
Result: String;

PostData := TIdMultiPartFormDataStream.Create;
try
PostData.AddFormField("edit1", "TextFromEdit1");
PostData.AddFormField("edit2", "TextFromEdit2");
Result := IdHTTP.Post("www.somesite.com/somescript.cgi",
PostData);
finally
PostData.Free;
end;

Parsing out the values from the HTML is your own responsibility separately.
Indy has no facilities for handling that.


Gambit