(PureBasic) Send HTTPS Get Without Waiting for the Response
This example demonstrates sending an HTTP GET request without waiting for the response.
IncludeFile "CkRest.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
rest.i = CkRest::ckCreate()
If rest.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Connect to the server using TLS
bAutoReconnect.i = 0
success.i = CkRest::ckConnect(rest,"example.com",443,1,bAutoReconnect)
If success = 0
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
ProcedureReturn
EndIf
; Send a GET request to https://example.com/some/path
success = CkRest::ckSendReqNoBody(rest,"GET","/some/path")
If success = 0
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
ProcedureReturn
EndIf
; OK, the request was sent.
; Close the connection.
maxWaitMs.i = 50
CkRest::ckDisconnect(rest,maxWaitMs)
Debug "GET Request Sent."
CkRest::ckDispose(rest)
ProcedureReturn
EndProcedure
|