This simple function will enable you to download any file from any url, without ftp.
'from$' is the full url, and 'to$' is the full download path (including the filename and extension) you want to save it as on your harddrive. The function returns a value of 0 if it succeeded, 1 if it failed.
You could also precompile it as a separate executable, running in hidden mode (set from the project settings in the ide), and execute it from your main application so that it runs in the background without affecting your main app.
It will probably trigger the user's firewall, asking for permission before it downloads anything - so any kiddies out there looking for ways to download code secretly onto a users machine - this isn't for you!
Language:
Dark Basic Pro
Code:
function download(from$,to$) if file exist(to$) then delete file to$ load dll "urlmon",1 failed=CALL DLL(1,"URLDownloadToFileA",0,from$,to$,0,0) delete dll 1 endfunction failed
(5 votes)
Tue, 06/05/2007 - 12:45
It is also worth mentioning that you can call PHP scripts like this, and pass GET values, which is very handy if you want to implement a simple high score system and such.
Mon, 07/02/2007 - 21:35
very nice thank you 8~)