1. --!movie
  2. --!encoding=utf-8
  3.  
  4. global $
  5.  
  6. ----------------------------------------
  7. -- Download a file via HTTPS (synchronous/blocking mode)
  8. ----------------------------------------
  9. on startMovie
  10.     _player.debugPlaybackEnabled = 1
  11.  
  12.     -- libs
  13.     $.import("curl")
  14.  
  15.     -- get a CURL handle (xtra instance)
  16.     ch = $.curl.init()
  17.  
  18.     -- specify options
  19.     ch.setOption($.curl.CURLOPT.URL, "https://valentin.dasdeck.com/xtras/curl_xtra/.test/test.mp3")
  20.     ch.setOption($.curl.CURLOPT.SSL_VERIFYPEER, 0)
  21.  
  22.     -- specify target filename
  23.     ch.setDestinationFile($.PATH & "downloaded.mp3")
  24.  
  25.     -- returnMode: 0=return error code (=default), 1=return data
  26.     -- => has to be 0 (or void) to download as file!
  27.     res = ch.exec()
  28.  
  29.     put "ERROR:" && curl_error(res) -- res=0 => "No error"
  30. --  put "SPEED_DOWNLOAD:" && ch.getInfo($.curl.CURLINFO.SPEED_DOWNLOAD)
  31. --  put "TOTAL_TIME:" && ch.getInfo($.curl.CURLINFO.TOTAL_TIME)
  32. end
  33.  
[raw code]