Link to home
Start Free TrialLog in
Avatar of ST3VO
ST3VOFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Indy idhttpclient component question

Hi all,

I know how to use the idHttpClient.get to get headers and stuff....

How can I filter errors: 200, 404, 501 etc using the Indy component please?

thx

st3vo
Avatar of moorhouselondon
moorhouselondon
Flag of United Kingdom of Great Britain and Northern Ireland image

https://www.experts-exchange.com/questions/24150649/Capturing-a-website-from-Delphi.html

The answer given there was to parse the idHttpClient.Response property.
Depends what your aim is with this: if this is analysis of your own site then you know what you do about 404's etc., but third-party sites often code up a more helpful 404 page, or simply fold the request back to the Home page.
Avatar of furmiga
furmiga

Hi there

Take a Shot


Ralph
procedure TForm1.Button1Click(Sender: TObject);
begin
  try
    IdHTTP1.Get('http://www.google.com/goofypage.html');
  except
    on e:EIdHTTPProtocolException do
    begin
      showmessage(inttostr(e.ErrorCode));
      showmessage(e.ToString);
    end;
  end;
end;

Open in new window

Avatar of ST3VO

ASKER

Hi all,

I know how to capture the errors as above. What I need is to filter them...

For example:

If error := '404' then showmessage('Error is 404'); etc..

know what I mean?

ASKER CERTIFIED SOLUTION
Avatar of furmiga
furmiga

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ST3VO

ASKER

Perfect Thanks a million :o)