Post in app not posting?

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Post in app not posting?

Post by ctflatt » Fri Dec 02, 2011 3:37 pm

Good morning!

I am still in pursuit of the elusive goal of creating an app that works :)

Here's the situation:

I have a web form that is functioning when completed online:

http://ctflatt.on-rev.com/made2move/testsms.php

Once completed, the form posts to:

http://ctflatt.on-rev.com/made2move/sendmail.php

This functions as expected when completed online.

My issue is posting the same data from my app. The process completely falls apart and I am trying to figure out why.

Assuming the web form fields are named "email" and "timeEnd", here is the script I am using:

Code: Select all

if gNotification is not empty then
            put (gNotification & gNotificationCarrier) into tSMS
            put "email=" before tSMS
            put the short system time into tTimeEnd
            put "&timeEnd=" before tTimeEnd
            set the text of field "notificationDEV" to (tSMS & tTimeEnd) ***To see the data as posted below
            post (tSMS & tTimeEnd) to URL "http://ctflatt.on-rev.com/made2move/sendmail.php"
            answer it
end if
The app is responding with the "answer it" response, but it doesn't appear to be posting the (tSMS & tTimeEnd)...

Am I missing something obvious?

If I need to provide more info, please let me know.

Thanks!

Todd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Post in app not posting?

Post by Mark » Fri Dec 02, 2011 5:55 pm

Todd,

Try this:

Code: Select all

if gNotification is not empty then
            put ("email=" & urlEncode(gNotification & gNotificationCarrier)) into tSMS
            put  "&timeEnd=" & urlEncode(the short system time) into tTimeEnd
            set the text of field "notificationDEV" to (tSMS & tTimeEnd)
            post (tSMS & tTimeEnd) to URL "http://ctflatt.on-rev.com/made2move/sendmail.php"
            answer it
end if
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Post in app not posting?

Post by ctflatt » Fri Dec 02, 2011 6:34 pm

Mark:

Thanks for responding.

I had tried URLEncode, as well, with the same results.

I used your provided code snippet, too, and it's just not wanting to POST the data for reuse...

My php is this:

Code: Select all

<?
$email = $_POST["email"];
$timeEnd = $_POST["timeEnd"];
mail( $email, "Reminder to Stand", "Please remember to stand again at $timeEnd.", "From: someone@somewhere.com" );
print "A reminder has was prepared for $email.";
?>
The return of $email in the "answer it" command is not being populated in the app, although the hardcoded string does get returned. This leads me to believe the posted data isn't getting posted, as it is when filling in the form online.

Any other ideas?

Many, many thanks for helping.

:Todd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Post in app not posting?

Post by Mark » Sat Dec 03, 2011 12:04 am

Hi Todd,

Shouldn't "<?" be "<?php"?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Post in app not posting?

Post by ctflatt » Sat Dec 03, 2011 12:59 am

Mark:

Hey! Again, thanks for taking the time to look at this.

I think either way the server knows, because the php is working fine. I did append the php script and re-uploaded with no change in app behavior (although the web form still works).

I need to post the name/value pairs to the sendmail.php page and reuse that info in a response. The response is working (minus the posted variable) in the app, which leads me to believe it's not posting correctly from the app.

:Todd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Post in app not posting?

Post by Mark » Sat Dec 03, 2011 1:19 am

Hi Todd,

I created a php file with the following code and nothing but this code:

Code: Select all

<?php
$email = $_POST["email"];
$timeEnd = $_POST["timeEnd"];
mail( $email, "Reminder to Stand", "Please remember to stand again at $timeEnd.", "From: someone@somewhere.com" );
print "A reminder has was prepared for $email.";
?>

<form action="mailtest.php" method="POST">
<input type="hidden" name="email" value="user@domain.com">
<input type="hidden" name="timeEnd" value="12:34">
<input type="submit" value="Submit">
</form>
and an otherwise empty stack with one button and the following script:

Code: Select all

on mouseUp
     put "email=" & urlEncode("user@domain.com") & \
     "&timeEnd=" & urlEncode(the short system time) into myData
     post myData to url "http://domain.com/mailtest.php"
     put it & cr & the result
end mouseUp
I stored the file as mailtest.php on my server and clicked the button. Can you do the same, make sure that the e-mail addresses, file paths and url's are correct, and tell me what you get in the message box?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Post in app not posting?

Post by ctflatt » Sun Dec 04, 2011 1:38 am

Mark:

Thanks, again, for providing the info.

When your code is executed at my end, the correct behavior is observed on the desktop, but the Android mobile version still returns nothing.

What I can surmise from this is that there is an issue with post on the mobile side of things...

Will check documentation again, but I know we are urlEncoding everything...

Geez.

Again, thanks for the help. I'll be working on this tomorrow and will let you know if I get anywhere.

Thanks!

:Todd

Post Reply