Board index » delphi » Submit an ASP Web Page and Collect Results

Submit an ASP Web Page and Collect Results

I need to be able to programmatically connect to an ASP base web site,
populate some fields and capture the resulting web page.  Is there any
helpful information around to get me started in Delphi.  I do not need the
web page to ever be displayed, just merely captured as a series of strings
or as a text file.

Can someone nudge me in the right direction for this?  My web/newsgroup
searches didn't.

-Johnnie

 

Re:Submit an ASP Web Page and Collect Results


If you use Indy, play with the TidHTTPClient - what you want to do is
basically send the data to the remote site - you do this by simply calling
say the POST function of the TidHTTPClient ... the data you can either send
from a pre-loaded stream, or from a HTML file u already have on disk.

/A.

Quote
"Johnnie Norsworthy" <jln2...@charter.net> wrote in message

news:3d4b005f$1_1@dnews...
Quote
> I need to be able to programmatically connect to an ASP base web site,
> populate some fields and capture the resulting web page.  Is there any
> helpful information around to get me started in Delphi.  I do not need the
> web page to ever be displayed, just merely captured as a series of strings
> or as a text file.

> Can someone nudge me in the right direction for this?  My web/newsgroup
> searches didn't.

> -Johnnie

Re:Submit an ASP Web Page and Collect Results


After downloading and installing "Proxomitron" I found a better tool to find
the Headers and PostData.  I modified the WebBrows example provided with
Delphi to tell me the Header and PostData using the
WebBrowserBeforeNavigate2() event.

Now I have a good idea of the actual data being sent during a post.  There's
quite a bit to decipher, but I'm getting closer.

For example:  From the WebBrows program I determine:
Content-Type: Content-Type: application/x-www-form-urlencoded
and
PostData=sql=%28FIELD2+Like+%27A%25%27+%29&FIELD1=&FIELD2=A&FIELD3=&FIELD4=&
FIELD5=&FIELD6=
(ignore line wrap)

How should this data be fed to the Indy HTTP Client and posted?  I'm sure I
need to translate something in the postdata.  I am using the HTTP CLient
Demo to test my tries.

Also, since I expect to return a large amount of data, should I stream
directly to disk?

If, in the web form the "submit" is in the form:
<FORM name=Form action=search/search1.asp method=post> ...
should the URL I use be the relative one presented in the action= field?

I know after I get one of these "posts" working the rest are going to drop
like dominos.

Thanks for any help,
Johnnie

Quote
Allen O'Neill wrote:

:: If you use Indy, play with the TidHTTPClient - what you want to do is
:: basically send the data to the remote site - you do this by simply
:: calling say the POST function of the TidHTTPClient ... the data you
:: can either send from a pre-loaded stream, or from a HTML file u
:: already have on disk.
::
:: /A.
::
::
:: "Johnnie Norsworthy" <jln2...@charter.net> wrote in message
:: news:3d4b005f$1_1@dnews...
::: I need to be able to programmatically connect to an ASP base web
::: site, populate some fields and capture the resulting web page.  Is
::: there any helpful information around to get me started in Delphi.
::: I do not need the web page to ever be displayed, just merely
::: captured as a series of strings or as a text file.
:::
::: Can someone nudge me in the right direction for this?  My
::: web/newsgroup searches didn't.
:::
::: -Johnnie

Re:Submit an ASP Web Page and Collect Results


The following code loads the data to post from a stream, then sends that
stream to the URL (cbURL.text).
The "Response" variable is getting back whatever reponse the remote http
server sends back.

             Source := TMemoryStream.Create;
              try
                Source.LoadFromFile(edPostFile.Text);
                HTTP.Post(cbURL.Text, Source, Response);
              finally
                Source.Free;

HTH.

/A.

Quote
"Johnnie Norsworthy" <jln2...@charter.net> wrote in message

news:3d4b5060$1_2@dnews...
Quote
> After downloading and installing "Proxomitron" I found a better tool to
find
> the Headers and PostData.  I modified the WebBrows example provided with
> Delphi to tell me the Header and PostData using the
> WebBrowserBeforeNavigate2() event.

> Now I have a good idea of the actual data being sent during a post.
There's
> quite a bit to decipher, but I'm getting closer.

> For example:  From the WebBrows program I determine:
> Content-Type: Content-Type: application/x-www-form-urlencoded
> and

PostData=sql=%28FIELD2+Like+%27A%25%27+%29&FIELD1=&FIELD2=A&FIELD3=&FIELD4=&
Quote
> FIELD5=&FIELD6=
> (ignore line wrap)

> How should this data be fed to the Indy HTTP Client and posted?  I'm sure
I
> need to translate something in the postdata.  I am using the HTTP CLient
> Demo to test my tries.

> Also, since I expect to return a large amount of data, should I stream
> directly to disk?

> If, in the web form the "submit" is in the form:
> <FORM name=Form action=search/search1.asp method=post> ...
> should the URL I use be the relative one presented in the action= field?

> I know after I get one of these "posts" working the rest are going to drop
> like dominos.

> Thanks for any help,
> Johnnie

> Allen O'Neill wrote:
> :: If you use Indy, play with the TidHTTPClient - what you want to do is
> :: basically send the data to the remote site - you do this by simply
> :: calling say the POST function of the TidHTTPClient ... the data you
> :: can either send from a pre-loaded stream, or from a HTML file u
> :: already have on disk.
> ::
> :: /A.
> ::
> ::
> :: "Johnnie Norsworthy" <jln2...@charter.net> wrote in message
> :: news:3d4b005f$1_1@dnews...
> ::: I need to be able to programmatically connect to an ASP base web
> ::: site, populate some fields and capture the resulting web page.  Is
> ::: there any helpful information around to get me started in Delphi.
> ::: I do not need the web page to ever be displayed, just merely
> ::: captured as a series of strings or as a text file.
> :::
> ::: Can someone nudge me in the right direction for this?  My
> ::: web/newsgroup searches didn't.
> :::
> ::: -Johnnie

Other Threads