I'll just paste the windows and mac versions here incase anybody needs them:
MAC OSX
Code: Select all
Procedure DownloadFromURL(URL.s, Filename.s)
Protected u = CocoaMessage(0, 0, "NSURL URLWithString:$", @URL)
Protected d = CocoaMessage(0, CocoaMessage(0, 0, "NSData alloc"), "initWithContentsOfURL:", u)
If d
CocoaMessage(0, d, "writeToFile:$", @Filename, "atomically:", #NO)
CocoaMessage(0, d, "release")
EndIf
ProcedureReturn d
EndProcedure
Code: Select all
URL.S = "http://www.google.com"
DownloadFilename.S = GetTemporaryDirectory() + "Test.htm"
If URLDownloadToFile_(0, @URL, @DownloadFilename, 0, 0) = #S_OK
MessageRequester("Info", URL + " has been downloaded sucessfully into " + DownloadFilename + "!", #MB_ICONINFORMATION)
Else
MessageRequester("Error", "The download of " + URL + " failed!", #MB_ICONERROR)
EndIf