Downloading webpages using sessions/cookies with TDownloadUrl (Delphi)

I've been testing some samples to save webpages using TDownloadUrl, and it was really amazing, but I found some problems certain webpages, those pages cannot let to access to real content because they need to start a session o set a cookie before, so I get two situations, TDownloadUrl does...

  1. not create/save a file with content from webpage supposedly downloaded (STATUS CODE : 5 --> dsEndDownloadData), this is because there is no cookie (STATUS CODE : 41 --> dsCookieStateDowngrade)
  2. not save the content right instead of it saves a webpage requesting to press a link to access to content wished

Is there any way to bypass these problems using Delphi's native components, that is, no third-party components (like TEmbeddedWB)?

Thanks in advance.

Note: I'm using Delphi XE2 under WinXP with Firefox 6.0 and IE 9.0

Upvotes: 2

Views: 396

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 598194

XE2 ships with Indy 10 (which is a third-party component, but at least it is a bundled one). You can use its TIdHTTP component instead of TDownloadURL. TIdHTTP supports cookies.

Upvotes: 1

Related Questions