idHTTP???

Giganews Newsgroups
Subject: idHTTP???
Posted by:  Codeman II (thegentlem…@webmail.co.za)
Date: Fri, 2 Dec 2005

Hi Friends,

I have tried but do not succeed.
My previous post did not leed to much victory as well.

My scenario:
1. I have a list of URLS (some might be invalid or dead).
2. I want to download these URLS (webpages) html source to local disk.
3. And do proper error handling / trapping.

Can anyone/someone please show me how to do this using the idHTTP component
of Indy 9.
I am using Delphi 7.

What I had in mind was basically this but I receive an error: "Socket error
# 11001 Host not found".
1. I am not sure what to specify as "Host" property?
2. Do I need to call "Connect()" prior to every "Get" or just "Connect" once
for all the "Get"s?
3. Will idHTTP handle and follows Redirects when I have set "HandleRedirects
:= True" automatically?

Please advice...
Examples and readings wil all appreciated.
Here is my example:

---code begin---

idHTTP.Host := "127.0.0.1";
idHTTP.Port := 80;
idHTTP.Connect();
Errors := 0;
For X := 0 to UrlList.Count - 1 do
begin
    memStream := TMemoryStream.Create;
    Try
        Try
            idHTTP.Get(UrlList.Strings[X], memStream);
          memStream.SaveToFile(IntToStr(X) + '.txt');
      Except
            Inc(Errors)
      end;
  Finally
        FreeAndNil(memStream);
  end;
end;

---code end---

Thanks a million!

Replies