Discussion:
Indy (other other) web browser code
(too old to reply)
Paul
2008-06-30 13:35:02 UTC
Permalink
Having a bit of fun with indy

Basically I want to write an app that visits a few differnet web pages and
then downloads the source of the page to a text file.

I have tried indy and have not had much success, same with TccpWebBrowser

Dioes anyone either have a sample of source for the above or a suggestion of
an alternate VCL package - pref free as this is just a fun bit of coding
Remy Lebeau (TeamB)
2008-06-30 16:40:40 UTC
Permalink
Post by Paul
I have tried indy and have not had much success,
same with TccpWebBrowser
Why not? You need to be more specific.


Gambit
Paul
2008-07-01 11:13:34 UTC
Permalink
When i call the connect method I get an 11004 exception, this same bit of
code worked in an older version of indy

TCP->Host = "http://www.google.com";
TCP->Port = 80;
TCP->Connect();
Remy Lebeau (TeamB)
2008-07-01 16:53:07 UTC
Permalink
Post by Paul
When i call the connect method I get an 11004 exception
That is because you are using the Host property wrong. You need to change
this:

TCP->Host = "http://www.google.com";

To this instead:

TCP->Host = "www.google.com";

With that said, you should be using the TIdHTTP component instead of the
TIdTCPClient component directly. Then you can do this:

AnsiString PageSource = HTTP->Get("http://www.google.com");

Or this:

TFileStream *PageSource = new TFileStream("c:\\some
folder\\somefile.html");
HTTP->Get("http://www.google.com", PageSource);
delete PageSource;
Post by Paul
this same bit of code worked in an older version of indy
No, it didn't. The Host property has never worked the way you are trying to
use it.


Gambit

Loading...