I wonder how to post or get from a HTTP Basic Authentication site with Indy 10

posted by vigil on 2009-07-12 05:50:40
I'd like to know how to get or post from a site with HTTP Basic Authentication with Indy 10 on Delphi 7.
I want to get / post to Twitter, but it asks for a Username and Password
For example http://twitter.com/statuses/friends_timeline.xml asks Username / password to get the proper XML
Thanks by advance.
web10
0
I think you have to use TIdHTTP.
 var
  h:TIdHTTP;
  s:string;
 begin
  h:=TIdHTTP.Create(nil);
  try
   h.Request.Username:='user';
   h.Request.Password:='12345';
   h.Request.BasicAuthentication:=True;
   s:=h.Get('YOUR_HTTP_PATH');
  finally
   Sys.FreeAndNil(h);
  end;
 end; 
5 answers - 8 questions
  Positive        Negative



Answer the question



Top Users
  • dail (12)
  • livin52 (3)
  • camu (3)
  • softweb (2)
  • Nadine (1)
  • Josware (1)
  • lfelipecr (1)
  • gregoriohc (1)
  • Mitu (1)
  • ryan714 (1)