downloading_20a_20file_20from_20a_20url
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
downloading_20a_20file_20from_20a_20url [2018/03/31 13:19] – external edit 127.0.0.1 | downloading_20a_20file_20from_20a_20url [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
//by Richard Russell, August 2007; amended July 2009//\\ \\ The simplest method of downloading a file (e.g. a web page) from an internet URL is to use the **URLDownloadToFile** API function as described in the main [[http:// | //by Richard Russell, August 2007; amended July 2009//\\ \\ The simplest method of downloading a file (e.g. a web page) from an internet URL is to use the **URLDownloadToFile** API function as described in the main [[http:// | ||
+ | <code bb4w> | ||
url$ = " | url$ = " | ||
file$ = @tmp$+" | file$ = @tmp$+" | ||
Line 15: | Line 16: | ||
IF res% ERROR 100, " | IF res% ERROR 100, " | ||
ENDPROC | ENDPROC | ||
+ | </ | ||
If you need to flush the cache to ensure you retrieve the latest version (e.g. it's a webcam picture) then it becomes slightly more complicated: | If you need to flush the cache to ensure you retrieve the latest version (e.g. it's a webcam picture) then it becomes slightly more complicated: | ||
+ | <code bb4w> | ||
url$ = " | url$ = " | ||
file$ = @tmp$+" | file$ = @tmp$+" | ||
Line 33: | Line 36: | ||
IF res% ERROR 100, " | IF res% ERROR 100, " | ||
ENDPROC | ENDPROC | ||
+ | </ | ||
These routines can be used for both **HTTP** and **FTP** downloads.\\ \\ However under some circumstances the above methods do not work reliably. In that case you may find the following routine to be more successful: | These routines can be used for both **HTTP** and **FTP** downloads.\\ \\ However under some circumstances the above methods do not work reliably. In that case you may find the following routine to be more successful: | ||
+ | <code bb4w> | ||
url$ = " | url$ = " | ||
file$ = @tmp$+" | file$ = @tmp$+" | ||
Line 90: | Line 95: | ||
wininet% += 0 : IF wininet% SYS " | wininet% += 0 : IF wininet% SYS " | ||
ENDPROC | ENDPROC | ||
- | Unfortunately with early versions of Internet Explorer (pre 4.0) the above code results in a memory leak when used for **http** downloads (see http:// | + | </ |
+ | Unfortunately with early versions of Internet Explorer (pre 4.0) the above code results in a memory leak when used for **http** downloads (see http:// | ||
+ | <code bb4w> | ||
server$ = " | server$ = " | ||
request$ = " | request$ = " | ||
Line 167: | Line 174: | ||
wininet% += 0 : IF wininet% SYS " | wininet% += 0 : IF wininet% SYS " | ||
ENDPROC | ENDPROC | ||
+ | </ |
downloading_20a_20file_20from_20a_20url.1522502357.txt.gz · Last modified: 2024/01/05 00:18 (external edit)