MarBor wrote: ↑Wed Oct 07, 2020 12:06 pm
Thanks a lot!
I managed to send the results in an email to myself with this from the app run in the LC IDE. I will try now from the HTML5 app.
It's maybe not optimal that an email client needs to be opened so that the participant needs to click on "send", though.
I also know some people who don't use/configure their email account in client software.
But this solution will definitely be a sufficient one in case I don't manage to get this post to PHP server solution to work.
Some news:
1)
I've tried it in HTML5 now, too, and in the HTML5 standalone version no email client software is opened and no email can be sent.
2)
I've now also tried around a bit with the POST solution. I included some code in my LC app to post the text file and I created a PHP file for the server (which is most likely the weak link, since I have no experience with server side stuff and PHP at all).
I ended up with the following code (adopted from LiveCode WIKI on keyword LibURLMultipartFormData) on my last card in the experiment:
Code: Select all
local tForm, tError, tUrl, tName, tMessage, tFile
put empty into tForm
put "http://myserver/specificdirectory/phpfile" into tUrl
put "someone" into tName -- not necessary ?
put "something" into tMessage -- not necessary ?
put "<file>" & fname & "/myFile[dot]txt" into tFile -- the file I want to send (fname - the file directory - was defined before in my script)
put libURLMultipartFormData \
(tForm, "name", tName, "message", tMessage, "file", tFile) \
into tError
if tError is not empty then
answer tError
else
set the httpHeaders to line 1 of tForm
post line 2 to -1 of tForm to url tUrl
## check the result, etc, here
set the httpHeaders to empty
end if
My PHP file is supposed to store what is posted to it in some directory on the server. Due to my lack of knowledge the script probably won't do that. It could also be the case that there is some issue with writing permission on the server ...
But I first wanted to check with some working target server whether stuff is actually posted from my LC app.
So I used the great website "Post Test Server V2" and from both the app run in the LC IDE and the windows standalone my text file is really posted to the target "toilet" (
) on Post Test Server V2.
But absolutely nothing arrives there when running the HTML5 standalone of the same app (but there's also no error message). I checked in the dictionary: libURLMultipartFormData is available for HTML5. Just as indicated in the dictionary entry I included the Internet library when generating the standalone.
Why doesn't it work in the HTML standalone?