LiveCode Server latency causing empty results

Mike Bonner bonnmike at gmail.com
Sat Aug 8 00:20:44 CEST 2015


A couple things, probably just typos but..

Your function begin and end names don't match.
You have 2 put lines on the same line, which won't work. (type on this one
i'm sure)
When you are getting stuff back out of the $_POST variable, "name" and
"message" are the array keys.  not "tName" or "tMessage"
To simplify (since this is a very simple example) you could do this on the
server side:
<?lc
repeat for each key tKey in $_POST
put tKey & ":" && $_POST[tKey] & cr -- puts out the key and value
end repeat
?>


For the client script (testing) this is what I ended up with.

put empty into tForm
put "http://myserver/testing.lc" into tUrl
put "dave" into tName
put "hello" into tMessage
if libURLMultipartFormData (tForm, "name", tName, "message", tMessage) is
not empty then
answer it
else
set the httpHeaders to line 1 of tForm
post line 2 to -1 of tForm to url tUrl
put it into tResults -- the actual returned data from the server script
set the httpHeaders to empty
end if
put tResults -- put the returned data into the msg box


On Fri, Aug 7, 2015 at 3:35 PM, Roger Eller <roger.e.eller at sealedair.com>
wrote:

> In the multiLine messageBox, I have this script:
> ---------------------
> put empty into tForm
> put "http://myServer/post_this.lc" into tUrl
> put "dave" into tName put "hello" into tMessage
> if libURLMultipartFormData (tForm, "name", tName, "message", tMessage) is
> not empty then
>  answer it ##error
> 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
> ---------------------
>
> In a "post_this.lc" file in the www root, I have this:
>        I THINK THIS IS WHAT I DON'T FULLY UNDERSTAND.  Nothing is returned
> when I execute the script in the messageBox.
>
> ---------------------
> <?lc
>    put receiveThis($_POST["name"],$_POST["tName"]) into tUser
>    put receiveThis($_POST["message"],$_POST["tMessage"]) into tMessage
> ?>
>
> <?lc
> function receiveThis tUser,tMessage
>    return tUser && tMessage
> end whoistUser
> ?>
> ---------------------
>
> ~Roger
>
>
>
> On Fri, Aug 7, 2015 at 1:14 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>
> > put "name1=value1&name2=value2&name3=value3" into tPost
> > post tPost to URL <whatever.Url.com>
> >
> > Its also handy to use liburlformdata to build your post string
> > also liburlmultipartformdata and liburlmultipartformaddpart
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list