What's the correct tsnetget syntax

JJS jjs at krutt.org
Wed Apr 10 14:39:49 EDT 2019


Hi,


i used to use :

put specialFolderPath("home") & "/help.pdf" into tHier
   libURLDownloadToFile 
"https://awebsite.com/afolder/help.pdf",tHier,"helpdownloaded"

    and then this

    on helpdownloaded
    put specialFolderPath("home") & "/help.pdf" into tFile
    if there is a file tFile then
       launch document tFile
    end if
end helpdownloaded

    so it would be opened in the standard pdf reader or in the browser 
widget
    now it worked good since lately

    But does tsnet and libURLdownLoadtofile bite each other?
    because i use tsnet for some smtp email funtions

    and it seems but i'm not sure that since then it won't download 
except when i put this on the next line:
    answer the result

    is that not weird?

    next i tried tsnetget, but it fails probably due to a fault of me:
    put tsNetGetFile("3", tHier, 
"https://awesomewebsite.com//fantasticfolder/help.pdf", 
"transferComplete") into tResult
    tsNetCloseConn "3"

     and then

     on transferComplete pID, pResult, pBytes, pCurlCode
       local tData,tError
    if pCurlCode is 0 and pResult is 200 then
       -- If successful, retrieve the downloaded data
       put tsNetRetrData(pID, tError) into tData
       helpdownloaded
    end if
end transferComplete

Nothing is happening and if i try the example from the webpage of 
techstrategies who wrote tsnet it's starts complaining that the 
parameters are not good.


Example 1:

    local tHeaders, tResult
    put tsNetGetFile(“1”, “/path/to/downloaded/file.dat”, \
       “ftp://user:pass@ftp.example.com/file.dat”, tHeaders, \
       “transferComplete”) into tResult

Example 2:

    on transferComplete pID, pResult, pBytes, pCurlCode
       local tData, tHeaders
       if pCurlCode is not 0 then
          answer tsNetRetrError(pID)
       else
          answer “File has been downloaded”
       end if
       tsNetCloseConn pID
    end transferComplete

    anyone a working example of how it should work?
    and maybe an explanation why the liburl command does not work 
anymore(correct)  (on lc904rc2)

    thanks a lot for any help!
    Sphere





More information about the use-livecode mailing list