Download a file

Download a file

Postby Silvio.Falconi » Sun Sep 01, 2019 8:37 pm

Do you have a small script for dowload a file from a site ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Download a file

Postby cnavarro » Sun Sep 01, 2019 9:37 pm

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Download a file

Postby ukoenig » Mon Sep 02, 2019 6:32 am

Christobal,

I got the error unresolved external

URLDownloadToFile
I think it will work only with HARBOUR not xHARBOUR

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Download a file

Postby Silvio.Falconi » Mon Sep 02, 2019 8:07 am

error with harbour
Code: Select all  Expand view  RUN
Progetto: nages, Ambiente: bcc7xHarbor:
[1]:Harbour.Exe nages.prg  /m /n0 /gc1 /es2 /a /iC:\Work\fwh\include /iC:\work\XHARBOUR\Include /jI18n\Main.hil /iinclude;c:\work\fwh\include;C:\work\XHARBOUR\include /oObj\nages.c
xHarbour 1.2.3 Intl. (SimpLex) (Build 20180217)
Copyright 1999-2017, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'nages.prg'...
Generating international list to 'I18n\Main.hil'...
Generating C source output to 'Obj\nages.c'...
Done.
Lines 149, Functions/Procedures 3, pCodes 594
[1]:Bcc32.Exe -M -c -DHB_OS_WIN_32 -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -IC:\Work\fwh\include -IC:\work\bcc7\Include\windows\sdk\;C:\work\XHARBOUR\Include  -nObj Obj\nages.c
Embarcadero C++ 7.00 for Win32 Copyright (c) 1993-2015 Embarcadero Technologies, Inc.
Obj\nages.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s -v @nages.bcl
Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, Inc.
Error: Unresolved external 'URLDownloadToFileA' referenced from C:\WORK\ERRORI\LOTTO\OBJ\NAGES.OBJ
Error: Unable to perform link
 



I tried also this source
Code: Select all  Expand view  RUN
 #include "fivewin.ch"

        function Main()
                LOCAL   nRet
               
                nRet := DOWNLOADFILE( "https://www.lottomatica.it/STORICO_ESTRAZIONI_LOTTO/storico.zip", "C:\" )
               
                MsgStop( nRet )
        RETURN NIL


         #pragma BEGINDUMP

    #include <Windows.h>
    #include <hbapi.h>
    #include <urlmon.h>

    HB_FUNC( DOWNLOADFILE )

    {
            HRESULT hr;

            hr = URLDownloadToFile( NULL, hb_parc( 1 ), hb_parc( 2 ), 0, NULL ) ;

            hb_retnl( hr ) ;
    }

    #pragma ENDDUMP






How decompress a file zip I downloaded ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Download a file

Postby bpd2000 » Mon Sep 02, 2019 9:30 am

Hi
You have to add urlmon library
Regards, Greetings

Try FWH. You will enjoy it's simplicity and power.!
User avatar
bpd2000
 
Posts: 153
Joined: Tue Aug 05, 2014 9:48 am
Location: India

Re: Download a file

Postby Silvio.Falconi » Mon Sep 02, 2019 9:39 am

Now I foud a script run ok
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function DescargFichDesdeUrl()
   Local cdate:=dtoc(date())
   local cFile := "C:\Work\Errori\download\storico_.zip"
   local cUrl  := "https://www.lottomatica.it/STORICO_ESTRAZIONI_LOTTO/storico.zip"

    DELETEURLCACHEENTRY( cUrl )

    URLDOWNLOADTOFILE( 0, cUrl, cFile )
 
RETURN NIL

DLL STATIC FUNCTION DELETEURLCACHEENTRY( cUrl AS LPSTR ) AS BOOL;
    PASCAL FROM "DeleteUrlCacheEntryA" LIB "wininet.dll"

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"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Download a file

Postby ukoenig » Mon Sep 02, 2019 10:36 am

Silvio,

YES works perfect

a download-test from my website

LOCAL cSaveAs := "I:\_Download\download\Store_.zip"
LOCAL cUrl := "http://www.Pflegeplus.com/DOWNLOADS/Gditest1.zip"


regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests