(PureBasic) HTTP Basic Authentication Test
Demonstrates how to do HTTP basic authentication using Chilkat.
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttp::setCkBasicAuth(http, 1)
CkHttp::setCkLogin(http, "foo")
CkHttp::setCkPassword(http, "bar")
; Let's say we want to download a file that is protected by HTTP Basic Authenication..
success.i = CkHttp::ckDownload(http,"https://www.example.com/someDir/document.pdf","qa_output/document.pdf")
If success = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
ProcedureReturn
EndIf
Debug "Success."
CkHttp::ckDispose(http)
ProcedureReturn
EndProcedure
|