Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Jerzy Kopinski
  Where is Jerzy Kopinski?
 Pruszcz Gdanski
 Poland
 Jerzy Kopinski
 Tags
Subject: RE: Downloading a file from WWW and FTP
Thread ID: 416416 Message ID: 416430 # Views: 49 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Web, FTP and other Internet Protocols
Date: Monday, December 29, 2014 2:28:40 PM         
   


> Hi Foxitians,
>
> In my application I have to download a file from WWW serwer or FTP Server. How to do that in a simplest way? I plan to use wininet.dll. Are there any examples of using the wininet.dll library in VFP?
>
> Thank sin advance,
> Jerzy


Hi Jerzy,

Consider the below Windows API HTTP download routine ...

* --- Declare my API in urlmon.dll
DECLARE INTEGER URLDownloadToFile IN urlmon.dll;
    INTEGER pCaller, STRING szURL,;
    STRING szFileName, INTEGER dwReserved,;
    INTEGER lpfnCB
 
* --- Declare my local memory variables used in this routine.
LOCAL cRemoteFile, cLocalFile, nResult

* --- SOURCE: Set my URL via HTTP into the domain and path if required and file name.
* ---         This is a folder on webserver with access permissions for anonymous logged
* ---         in user.  In this case website running under IIS.
cRemoteFile = "http://www.marathongriffincomputers.com/FieldMobi.exe"

* --- TARGET: Set a valid path where to download the file into.
cLocalFile  = "D:\DownloadFolder"

* --- Call the download API.
nResult = URLDownloadToFile(0, cRemoteFile, cLocalFile, 0,0)
 
* --- Test the results of the download. 
IF nResult = 0
    ? "The file has been downloaded."
ELSE
    ? "The URLDownloadToFile call failed with error code:", nResult
ENDIF


Not that hard now that you see it - lol

Pete "the IceMan", from the Great White North of Canada.
www.marathongriffincomputers.com

ENTIRE THREAD

Downloading a file from WWW and FTP Posted by Jerzy Kopinski @ 12/29/2014 11:47:27 AM
RE: Downloading a file from WWW and FTP Posted by Mike Gagnon @ 12/29/2014 11:55:10 AM
RE: Downloading a file from WWW and FTP Posted by Jerzy Kopinski @ 12/29/2014 12:18:25 PM
RE: Downloading a file from WWW and FTP Posted by Mike Gagnon @ 12/29/2014 12:25:27 PM
RE: Downloading a file from WWW and FTP Posted by Pete Sass @ 12/29/2014 2:28:40 PM
RE: Downloading a file from WWW and FTP Posted by Jerzy Kopinski @ 12/29/2014 5:26:31 PM