Sample code for 30+ languages & platforms
Lianja

Transition from Http.PFile to Http.HttpFile

Provides instructions for replacing deprecated PFile method calls with HttpFile.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loHttp = createobject("CkHttp")

lcVerb = "POST"
lcUrl = "https://example.com/"
lcLocalFilePath = "c:/temp/requestBodyContent.dat"
lcContentType = "application/octet-stream"

// ------------------------------------------------------------------------
// The PFile method is deprecated:

loResponseObj = loHttp.PFile(lcVerb,lcUrl,lcLocalFilePath,lcContentType,.F.,.F.)
if (loHttp.LastMethodSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    return
endif

// ...
// ...

release loResponseObj

// ------------------------------------------------------------------------
// Do the equivalent using HttpFile.
// Your application creates a new, empty HttpResponse object which is passed 
// in the last argument and filled upon success.

loResponseOut = createobject("CkHttpResponse")
llSuccess = loHttp.HttpFile(lcVerb,lcUrl,lcLocalFilePath,lcContentType,loResponseOut)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loResponseOut
    return
endif



release loHttp
release loResponseOut