Page 1 of 1

Call a PHP script from a livecode server script

Posted: Sun Aug 03, 2014 3:08 am
by johnkane
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

Re: Call a PHP script from a livecode server script

Posted: Sun Aug 03, 2014 7:52 pm
by Pyrros
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

Re: Call a PHP script from a livecode server script

Posted: Mon Aug 04, 2014 2:45 am
by johnkane
Thanks,

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

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

John

Re: Call a PHP script from a livecode server script

Posted: Mon Aug 04, 2014 3:29 am
by FourthWorld
Are you able to use "get url..." to obtain data from any other host within your LC Server script?

Re: Call a PHP script from a livecode server script

Posted: Mon Aug 04, 2014 2:56 pm
by johnkane
Hi Richard,

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

John

Re: Call a PHP script from a livecode server script

Posted: Mon Aug 04, 2014 9:39 pm
by jiml
Are the permissions of your LiveCode script correctly set for execution?

Re: Call a PHP script from a livecode server script

Posted: Mon Aug 11, 2014 9:50 pm
by johnkane
Good question. What should they be? 755?

Re: Call a PHP script from a livecode server script

Posted: Mon Aug 11, 2014 10:30 pm
by FourthWorld
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.