You can use WinHTTP , check the IWinHttpRequest.SetCredentials method
check this sample
uses Variants, SysUtils, WinHttp_TLB; Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0; Var Http: IWinHttpRequest; begin try Http := CoWinHttpRequest.Create; try Http.Open('GET', 'http://Foo.com/home', False); Http.SetCredentials('AUser','APassword', HTTPREQUEST_SETCREDENTIALS_FOR_SERVER); Http.Send(EmptyParam); //Do your stuff finally Http:=nil; end; except on E:Exception do Writeln(E.Classname, ': ', E.Message); end; end.
source share