Article View: borland.public.cppbuilder.internet.web
Article #205Re: Logging in with TIdHTTP
From: Remy Lebeau (TeamB)
Date: Mon, 02 Jul 2007 17:15
Date: Mon, 02 Jul 2007 17:15
35 lines
2082 bytes
2082 bytes
"Tom Byars" <tam118118@hotmail.com> wrote in message
news:46878587@newsgroups.borland.com...
> On setting the HandleRedirection property to true I find that the
> text returned is for the sites login / register web page. Opening an
> IE window and manually logging in doesn't help. Is there a way of
> logging in using TIdHTTP? If not, is there a way of finding where
> the web site is looking for the cookies so I can put these in place
> programatically.
The website expects you to POST an input form containing your
username/password. You can do that very easily using a TStringList
with the TIdHTTP::Post() method, ie:
TStringList *Fields = new TStringList;
try
{
Fields->Values["in_un"] = "username";
Fields->Values["in_pw"] = "password";
IdHTTP1.Post("https://reg.racingpost.co.uk/cde/login_iframe.sd",
Fields);
}
__finally
{
delete Fields;
}
If successful, then your original Get() should work. Something else
to keep in mind - the above URL is a secure page, so make sure that
you have an SSL-enabled IOHandler attached to the TIdHTTP beforehand.
Gambit
Technical Details
Message-ID:
<4689349a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46878587@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,e38d4989d40bbffa X-Google-Attributes: gidfeeec,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.web References: <46878587@newsgroups.borland.com> Subject: Re: Logging in with TIdHTTP Date: Mon, 2 Jul 2007 10:15:43 -0700 Lines: 37 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: 75.82.252.126 Message-ID: <4689349a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1183397018 75.82.252.126 (2 Jul 2007 10:23:38 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail