Using IdHTTP to download web page, even if error occurs

I want to use the Indy IdHTTP component to fetch two web sites and compare them. Is it possible to use Indy to download the webpage source, even with 404 or any >200 error is found? So if there is any text on the page, no matter if there is any error, I want to download it.

Upvotes: 0

Views: 391

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597941

If TIdHTTP receives a response code that results in an EIdHTTPProtocolException exception being raised, you can access the page's text from the EIdHTTPProtocolException.ErrorMessage property.

Upvotes: 4

Related Questions