Call a PHP script from a livecode server script

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnkane
Posts: 9
Joined: Sun Nov 06, 2011 1:06 am

Call a PHP script from a livecode server script

Post by johnkane » Sun Aug 03, 2014 3:08 am

I am having what seems to be a simple problem to solve, but I can't.

How do I post data to an existing php script? I receive it fine with this

<?lc
put $_POST["FName"] into firstname
put "FName=" & firstname into PostToPHPScript
post PostToPHPScript to URL("http://domain.com/receivepost.php")
?>

My php script reads:

<?php
$fname=($_POST["FName"]);
echo $fname;
?>

and the page errors with:

"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@johnkane.on-rev.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."

Obviously, I am using on-rev.com as my host.

The php script works fine when called as the form action. And the LiveCode script does as well. It is only when I do a livecode server html post to a php script that it fails.

Any help would be appreciated.

Thanks,

John

Pyrros
Posts: 9
Joined: Sun Apr 20, 2014 8:26 pm

Re: Call a PHP script from a livecode server script

Post by Pyrros » Sun Aug 03, 2014 7:52 pm

Hi John

Looks like that should work - maybe best to talk to on-rev tech support.

This works fine on my server:

LC Script:
<?lc
put "test" into firstname
put "FName=" & firstname into PostToPHPScript
post PostToPHPScript to URL("path-to-php-script")
put it
?>

PHP Script:
<?php
$fname = $_POST["FName"];
echo $fname;
?>

Maybe just check that the filenames are correct, and see if the log file shows anything.

Kind Regards
Simon

johnkane
Posts: 9
Joined: Sun Nov 06, 2011 1:06 am

Re: Call a PHP script from a livecode server script

Post by johnkane » Mon Aug 04, 2014 2:45 am

Thanks,

I thought it should work too, but it doesn't.

I will reach out to the folks at on-rev.

John

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9833
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Call a PHP script from a livecode server script

Post by FourthWorld » Mon Aug 04, 2014 3:29 am

Are you able to use "get url..." to obtain data from any other host within your LC Server script?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

johnkane
Posts: 9
Joined: Sun Nov 06, 2011 1:06 am

Re: Call a PHP script from a livecode server script

Post by johnkane » Mon Aug 04, 2014 2:56 pm

Hi Richard,

I haven't tried a http get, if that is what you mean.

John

jiml
Posts: 336
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: Call a PHP script from a livecode server script

Post by jiml » Mon Aug 04, 2014 9:39 pm

Are the permissions of your LiveCode script correctly set for execution?

johnkane
Posts: 9
Joined: Sun Nov 06, 2011 1:06 am

Re: Call a PHP script from a livecode server script

Post by johnkane » Mon Aug 11, 2014 9:50 pm

Good question. What should they be? 755?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9833
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Call a PHP script from a livecode server script

Post by FourthWorld » Mon Aug 11, 2014 10:30 pm

Yes, the 7 gives you as the file's owner the permission to do anything you like with it, while the two 5s grant execution permission to the ownership group and everyone else but without write permission.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “CGIs and the Server”