(DataFlex) HTTP Basic Authentication Test
Demonstrates how to do HTTP basic authentication using Chilkat.
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
String sTemp1
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComBasicAuth Of hoHttp To True
Set ComLogin Of hoHttp To "foo"
Set ComPassword Of hoHttp To "bar"
// Let's say we want to download a file that is protected by HTTP Basic Authenication..
Get ComDownload Of hoHttp "https://www.example.com/someDir/document.pdf" "qa_output/document.pdf" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Success."
End_Procedure
|