FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour download a file
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
download a file
Posted: Tue May 27, 2014 11:43 AM

How I can download a file txt from a site ?
is there a small sample please ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: download a file
Posted: Tue May 27, 2014 12:48 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: download a file
Posted: Tue May 27, 2014 04:06 PM
I use this code :
Code (fw): Select all Collapse
MsgRun("Downloading ...","A moment please ...",{||IF(URLDownloadToFile(0,"http://www.maconsult.be/download/report.txt.txt","C:\report.txt",0,0 ) == 0,UpdDown:=.T.,UpdDown:=.F.)})


It works very well.

Good luck.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: download a file
Posted: Wed May 28, 2014 07:08 AM

Error: Unresolved external '_HB_FUN_URLDOWNLOADTOFILE' referenced from ...

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: download a file
Posted: Wed May 28, 2014 08:59 AM
You have to add this to your prg.
Code (fw): Select all Collapse
DLL Function URLDownloadToFile(pCaller AS LONG, szURL AS STRING, szFileName AS STRING, dwReserved AS LONG, lpfnCB AS LONG) AS LONG PASCAL FROM "URLDownloadToFileA" LIB hLib
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: download a file
Posted: Wed May 28, 2014 10:02 AM

Error description: Error BASE/1003 Variable does not exist: HLIB

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: download a file
Posted: Wed May 28, 2014 10:12 AM
You have to load lib before calling URLDownloadToFile

Code (fw): Select all Collapse
hLib = LOADLIBRARY( "urlmon.dll")
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: download a file
Posted: Fri May 30, 2014 09:57 AM

but not run also I cannot download a txt file

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion