- Code: Select all Expand view
#command DEFAULT <var> := <xpr> => if <var> = NIL ; <var> := <xpr> ; end
#command IF <condition> THEN <*statements*> => if <condition> ; <statements> ; end
Function Scarica_Storico(cUrl,cZipFile)
local nVersionWin:=cWinVersion()
If val(cWinVersion())=7
Download_Windows_Seven(cUrl,cZipFile)
else
GETURLTOFILE(cUrl,cZipFile)
Endif
return nil
STATIC FUNCTION GETURLTOFILE( cUrl, cFile, cUsr, cPsw )
LOCAL lOk := .F.
LOCAL oHtp, oStr, ex
DEFAULT cFile := CFILENAME( STRTRAN( cUrl, "/", "\" ) )
//TRY
oHtp = CREATEOBJECT( "Msxml2.XMLHTTP.6.0" )
oHtp:Open( "POST", cUrl, .F., cUsr, cPsw )
oHtp:Send()
IF oHtp:Status != 200 THEN BREAK
MemoWrit(cFile,oHtp:ResponseBody)
//oStr = CREATEOBJECT( "ADODB.Stream" )
//oStr:Open()
//oStr:Type = 1
//oStr:Write( oHtp:ResponseBody )
//oStr:SaveToFile( cFile, 2 )
//oStr:Close()
lOk = .T.
//CATCH ex
// ? ex:message
//END
RETURN lOk
- Code: Select all Expand view
- Error description: (DOS Error -2147352567) WINOLE/1007 Errore di sistema: -2147012890.
(0x80072EE6): msxml6.dll
Args:
[ 1] = C POST
[ 2] = C .\data\
[ 3] = L .F.
[ 4] = U
[ 5] = U
Stack Calls
===========
Called from: => TOLEAUTO:OPEN( 0 )
Called from: source\Aggiorna.prg => GETURLTOFILE( 94 )
I tried also with
Function Scarica_Storico(cUrl,cZipFile,oSay)
local nVersionWin:=cWinVersion()
local cFile,cREto
If val(cWinVersion())=7
Download_Windows_Seven(cUrl,cZipFile)
else
cRet := WebPageContents( cUrl )
MEMOWRIT( cZipFile,cRet)
Endif
return nil
but not happen nothing