1. --!movie
  2. --!encoding=utf-8
  3.  
  4. global $
  5.  
  6. ----------------------------------------
  7. -- Download a file with http get (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, "http://valentin.dasdeck.com/xtras/curl_xtra/.test/test.mp3")
  20.  
  21.     -- specify target filename
  22.     ch.setDestinationFile($.PATH & "downloaded.mp3")
  23.  
  24.     -- returnMode: 0=return error code (=default), 1=return data
  25.     -- => has to be 0 (or void) to download as file!
  26.     res = ch.exec()
  27.  
  28.     put "ERROR:" && curl_error(res)
  29. --  put "SPEED_DOWNLOAD:" && ch.getInfo($.curl.CURLINFO.SPEED_DOWNLOAD)
  30. --  put "TOTAL_TIME:" && ch.getInfo($.curl.CURLINFO.TOTAL_TIME)
  31. end
  32.  
[raw code]