for this example you need for windows:
libcurl.dll
libcrypto-1_1.dll
libssl-1_1.dll
From:
https://curl.haxx.se/windows/
curl for XX bit
and below
OpenSSL
Or simply use my zip file:
viewtopic.php?p=591235
for linux:
nothing todo, since the full libcurl.so is installed and PB uses this 'full' lib.
for OSX:
no idea, but I think it behaves like linux.
Code: Select all
; FTPS
;
; https://curl.se/libcurl/c/ftpsget.html
;
EnableExplicit
#LibCurl_DLL$ = "libcurl.dll"
IncludeFile "libcurl.pbi"
Structure FtpFileStructure
filename$
file.i
EndStructure
ProcedureC.l my_fwrite(*buffer, Size, NMemB, *out.FtpFileStructure)
Protected Result.i
If Not *out\file
*out\file = CreateFile(#PB_Any, *out\filename$)
If Not *out\file
Result = -1
EndIf
EndIf
If Result = 0
Result = WriteData(*out\file, *buffer, (Size & 255) * NMemB)
EndIf
ProcedureReturn Result
EndProcedure
Define curl.i, ftpfile.FtpFileStructure, res.i
InitNetwork()
curl_global_init(#CURL_GLOBAL_DEFAULT)
curl = curl_easy_init()
If curl
ftpfile\filename$ = GetPathPart(ProgramFilename()) + "file.txt"
curl_easy_setopt_str(curl, #CURLOPT_URL, "ftps://user@server/home/user/file.txt")
curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @my_fwrite())
curl_easy_setopt(curl, #CURLOPT_WRITEDATA, @ftpfile)
curl_easy_setopt(curl, #CURLOPT_USE_SSL, #CURLUSESSL_ALL)
res = curl_easy_perform(curl)
If res = #CURLE_OK
Debug "Ok"
Else
Debug "Error: " + curl_easy_strerror(res)
EndIf
If IsFile(ftpfile\file)
CloseFile(ftpfile\file)
EndIf
curl_easy_cleanup(curl)
EndIf
curl_global_cleanup()
I have no FTPS server which I can access at the moment.
But it should work. If not: report it.