tsnet on livecode server
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
tsnet on livecode server
how do i use tsnet on the livecode server. I use hostm and livecode business can you share code snippets.
thank you
thank you
Last edited by keliko on Fri Aug 21, 2020 8:06 pm, edited 1 time in total.
Re: tsnet on livecode server
You have to download the server version from the store part of your login to the LiveCode website to use tsnet on server. The community version on the public downloads site will not work.
If you use https or encryption, you also need to ensure that you upload the cert folder to the server.
In the LC server script, you need to initialise the tsNet library before making any tsNet calls. (And close afterwards for good housekeeping.)
I might be able to get some more specific script snippets later when I am not just using this phone, but that should hopefully give you a start.
If you use https or encryption, you also need to ensure that you upload the cert folder to the server.
In the LC server script, you need to initialise the tsNet library before making any tsNet calls. (And close afterwards for good housekeeping.)
I might be able to get some more specific script snippets later when I am not just using this phone, but that should hopefully give you a start.
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: tsnet on livecode server
If you can proof that you have a legal license of Livecode Server Business then the people at HostM will install the Business version of Livecode Server for your HostM account. No need to download and install it manually.I use hostm and business livecode can you share code snippets.
As SparkOut already mentioned, you have to run tsInit to initalize tsNet before you can use it.
The following script downloads the Release Notes for LC 9.6.1 from the Livecode Server and stores it in the public_html folder.
Code: Select all
<?lc
tsnetinit
put the home folder &"/public_html/LiveCodeNotes-9_6_1.pdf" into pFile
put "https://livecodestatic.com/downloads/livecode/9_6_1/LiveCodeNotes-9_6_1.pdf" into pURL
put tsNetGetFileSync(pFile, pURL, xHeaders, rOutHeaders, rBytes,)
?>
Code: Select all
<?lc
tsnetinit
put "https://livecodestatic.com/downloads/livecode/9_6_1/LiveCodeNotes-9_6_1.pdf" into pURL
put tsNetGetSync(pURL, xHeaders, rOutHeaders, rResult, rBytes,) into tData
put "LiveCodeNotes-9_6_1.pdf" into tFile
put header "Content-Type: application/octet-stream"
put new header "Content-Disposition: attachment; FileName=" & tFile
put tData
?>
Regards,
Matthias
Last edited by matthiasr on Fri Aug 21, 2020 8:34 pm, edited 2 times in total.
Re: tsnet on livecode server
Thanks Matthias and SparkOut
i will try it later.
i will try it later.
Re: tsnet on livecode server
Very interesting.
I just ask HostM to do the "upgrade" on my account (they did it a few minutes, after sending them my invoice of LC Indy, amazing).
One question though : "(And close afterwards for good housekeeping.)"
You mean after every TSNet command within a lc server script, we have to close ? with tsNetClose ?
I just ask HostM to do the "upgrade" on my account (they did it a few minutes, after sending them my invoice of LC Indy, amazing).
One question though : "(And close afterwards for good housekeeping.)"
You mean after every TSNet command within a lc server script, we have to close ? with tsNetClose ?
Last edited by bangkok on Sat Aug 22, 2020 5:46 am, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 9847
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: tsnet on livecode server
Just curious: which tsNet features do you need on a server that aren't provided with libURL?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: tsnet on livecode server
I just want to try tsNet external on the server although it can be done with libURL.
and it turned out that the livecode was amazing. I can be a fullstack.with syntax like English language.
and it turned out that the livecode was amazing. I can be a fullstack.with syntax like English language.
Re: tsnet on livecode server
I will answer for myself : i do not know... yetFourthWorld wrote: ↑Sat Aug 22, 2020 4:27 amJust curious: which tsNet features do you need on a server that aren't provided with libURL?
I just want to do experiments.
Something might be easier with tsNet though : sending email (with a third party account, like microsoft 365 office).
-
- VIP Livecode Opensource Backer
- Posts: 9847
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: tsnet on livecode server
If you get the authentication part of that *office 365 integration down please let me know. MS seems to have some oddly cumbersome config for their OAuth2 setup.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: tsnet on livecode server
I can just speak for myself.FourthWorld wrote: ↑Sat Aug 22, 2020 4:27 amJust curious: which tsNet features do you need on a server that aren't provided with libURL?
We are running several cronjobs (livecode server scripts) for file backup, MySQL DB cleaning and other maintenance stuff.
Wnile php has smtp and ftp libraries, Livecode server cannot do such things out of the box using just liburl. There are no libraries for SMTP over TLS or SFTP/FTPes available.
So we are using tsNet with LivecodeServer currently for
1. sftp/FTPes file transfers
2. sending notification emails
Matthias
Re: tsnet on livecode server
As for me, my need for tsNet on server is to securely fetch dealers, product info and stock levels from brand owner's site, which is then parsed to update the various individual brand sites. Until tsNet, this had to be shelled out to wget or curl.
Re: tsnet on livecode server
Well that's my point.FourthWorld wrote: ↑Sat Aug 22, 2020 7:30 amIf you get the authentication part of that *office 365 integration down please let me know. MS seems to have some oddly cumbersome config for their OAuth2 setup.
With createSmtpMessage and tsNetSmtpSync and
put true into tSettings["use_ssl"]
and using the Microsoft SMTP server : smtp://smtp.office365.com:587
I can send an email from a 365 office account email address, from a desktop app !
That's not a project, nor an idea. It works.
This is why i was thinking about this, with LC server.
-
- VIP Livecode Opensource Backer
- Posts: 9847
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: tsnet on livecode server
SMTP is good that way. If you need anything in the MS APIs that require OAuth please keep me posted.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn