I'm having trouble with a software program that uses URLDOWNLOADTOFILE.dll to download a file.
I also tried oHttp := CreateObject("WinHttp.WinHttpRequest.5.1"), but it still gives me an error.
old test
Code: Select all | Expand
Function test()
local cUrl:= "https://www.silvio.it/test.zip"
local lreturn
local cZipFile := "storico_"+DtoS(Date())+".zip"
IF URLDOWNLOADTOFILE( 0,cUrl , cZipFile) =0
lreturn := .t.
else lreturn := .f.
endif
msginfo( lreturn)
return nil
DLL FUNCTION URLDOWNLOADTOFILE( pCaller AS LONG, cUrl AS LPSTR, cFileName AS LPSTR, nReserved AS DWORD, nFnCB AS LONG ) AS LONG; PASCAL FROM "URLDownloadToFileA" LIB "urlmon.dll"
test new not run
Code: Select all | Expand
#include "fivewin.ch"
function Test()
local oHttp := CreateObject("WinHttp.WinHttpRequest.5.1")
local cUrl := "https://www.silvio.it/test.zip"
local cZip := "storico_" + DtoS(Date()) + ".zip"
oHttp:SetOption( 4, 13056 ) // ignora errori SSL
oHttp:Open( "GET", cUrl, .F. )
oHttp:Send()
if oHttp:Status == 200
MemoWrit( cZip, oHttp:ResponseBody )
MsgInfo( "Scaricato correttamente ??" )
else
MsgStop( "Errore HTTP: " + LTrim(Str(oHttp:Status)) )
endif
return nilI rename the right url
I check if I can download the file and run good
the problem is not the tests but my Windows 10 computer is not updated so it has an expired certificate. How can I get around this error?