🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #557

Re: How to use TIdHTTP::Get() to get 'login-protected' website-contents (when knowing the user-name/password)?

#557
From: Remy Lebeau (TeamB)
Date: Mon, 27 Mar 2006 18:26
49 lines
3242 bytes
<MR> wrote in message news:ea9f22d43tn11hsanfouueqru7oo3lige6@4ax.com...

> Because this content is more than one page and I want to access
> to it offline, I tried to get the same pages with TIdHTTP's Get()-
> methode (hoping, because login-information is already stored in the
> cookie (or somewhere else on my computer), I would get access
> to it without providing any password information. But unfortunately
> I was wrong.

Indy does not persistently store cookies automatically.  That is your own
responsibility to manage.  Indy only stores cookies in memory on a
per-instance basis.  Once the HTTP's cookie manager is destroyed, so are the
cookies that it currently has.

> Comparing IE's source and TIdHTTP::Get()-result is also quite
> different: In the first one is my login-information, in the second one
> (when displayed with IE afterwards) quite the same page I get in
> IE if I would have not provided my login-information.

How exactly are they different?  What does your actual code look like?  What
does the downloaded HTML look like between IE and TIdHTTP?

Do note that many servers send different content to different browser types.
Many servers prefer IE, and send something else to non-IE browsers.  You can
use the TIdHTTP's UserAgent property to make the server think that IE is
connecting to it, when it really isn't.

> So, how can I download the required pages. Can I use TIdHTTP::Get()
> at all? Can I provide the Get()-command with some login/password
> information.

> The very best solution would be, if there would be a property in TidHTTP,
> which would allow having access to IE's cookies ;-)

That is not going to happen.  For starters, not everyone uses IE to begin
with.  Second, the formats used for storing cookies on the hard drive are
not standardized at all.  Every browser stores cookies differently.  If you
want access to IE's cookies, then you have to parse them yourself and then
put the extracted data into the TIdHTTP's cookie manager manually.

> Or can I perhaps call IE from inside my program and let it
> download and store the required pages automatically?

You can use Borland's TCppWebBrowser component for that.  It is a wrapper
for IE's ActiveX control.


Gambit
Technical Details
Message-ID: <44282eda$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <ea9f22d43tn11hsanfouueqru7oo3lige6@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,3b4cf1b4db85efc1
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <ea9f22d43tn11hsanfouueqru7oo3lige6@4ax.com>
Subject: Re: How to use TIdHTTP::Get() to get 'login-protected' website-contents (when knowing the user-name/password)?
Date: Mon, 27 Mar 2006 10:26:14 -0800
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44282eda$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1143484122 68.69.17.41 (27 Mar 2006 10:28:42 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail