LC Script in PHP File
Andre Garzia
andre at andregarzia.com
Tue Nov 25 06:18:55 EST 2014
Peter,
Most PHP installations will not allow file_get_contents() to be run on
localhost to prevent infinite loops. I've been hurt by that before.
cheers
On Sun, Nov 23, 2014 at 5:09 AM, Peter W A Wood <peterwawood at gmail.com>
wrote:
> You should be able to use file_get_contents in PHP to do what you want.
> Though it will take longer to get the results from LiveCode than it would
> from PHP.
>
> Here is an example:
>
> PHP file:
> <!DOCTYPE html>
> <html>
> <head>
> <meta http-equiv="content-type"
> content="text/html;charset=utf-8" />
> <title>Testing Getting Results From Website</title>
> </head>
> <body>
> <p>
> <?php
> $livecode_returned = file_get_contents('
> http://localhost/webtest.lc');
> echo($livecode_returned);
> ?>
> </p>
> </body>
> </html>
>
> LiveCode file:
> <?lc
> if $_GET["name"] <> "" then
> put "Peter" into tName
> else
> put "World" into tName
> end if
> put header "Content-Type: text/html"
> put "<html>"
> put "<head>"
> put "<title>My LiveCode Server Test Page</title>"
> put "</head>"
> put "<body>"
> put "<h1>My LiveCode Server Test Page</h1>"
> put "<p>Hello" && tName && "from LiveCode Server</p>"
> put "<p>The date is" && the internet date & "</p>"
> put "<p>" & the second char of "12345" & "</p>"
> put "</body>"
> put "</html>"
> ?>
>
> Results:
> My LiveCode Server Test Page
>
> Hello World from LiveCode Server
>
> The date is Sun, 23 Nov 2014 14:27:24 +0800
>
> 2
>
> Hope this helps.
>
> Peter
>
> > On 23 Nov 2014, at 13:29, Nakia Brewer <Nakia.Brewer at westrac.com.au>
> wrote:
> >
> > Hi,
> >
> > I am in the process of putting a web app together using the UserFrosting
> system as a starting point.
> > I am slowly getting the hang of the framework and am now wishing to
> start using LC Server to do some backend crunching to render the pages. (Im
> not picking up PHP as fast as I hoped!)
> >
> > The UserFrosting system bases all of its page contents in PHP Files by
> design.
> >
> > For example the index file is index.php
> >
> > My question is, am I able to call LC functions from within a PHP file?
> >
> > For example, in the below page (which is a PHP file)
> > Red content...
> >
> > <?php
> > /*
>
> _______________________________________________
> 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
>
--
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.
More information about the use-livecode
mailing list