3

Problem:

I have a number of variables stored in $_SESSION in PHP and I am wondering if it is possible at all to transfer these to Livecode scripts (.lc)?

Current solution:

I use $_GET to move information but I would like to know a way where you can connect PHP with Livecode and transfer information easier.

Any ideas?

kexxcream
  • 5,873
  • 8
  • 43
  • 62

3 Answers3

2

Have you looked at CallPHP library by David Beck? I came across this library sometimes ago and it helped me.

Here is a description of the library culled from the website:

"CallPHP enables a LiveCode script to easily call PHP functions on a remote server and have values returned to it from the PHP functions. CallPHP is very easy to use. Here is an example of how CallPHP can be used from a LiveCode script to call a PHP function on a remote server that adds two numbers together:

put callPHP_Call( "AddNumbers", 3, 4 ) into callPHPRes
put callPHP_GetResult( callPHPRes ) into theResult
-- theResult now contains 7

http://www.rotundasoftware.com/livecode/

The session variables can be called from (a) function(s) as described above after installing the library.

dtechplus
  • 579
  • 1
  • 6
  • 21
0

You could share variables in a database table. Both PHP and LiveCode can then query the values as they need them.

splash21
  • 799
  • 4
  • 10
0

LiveCode sessions and PHP sessions should be compatible. If you set the LC session path to the same path used by PHP, you should be able to use the same session veriables. In PHP you can see the session save path with

session_savePath();

and in LiveCode you can set the path with

set the sessionSavePath to "your/php/session/path"

It will take some experimentation, but it should be possible.

Mark
  • 2,380
  • 11
  • 29
  • 49
  • 1
    I did an "echo session_save_path()" and it gave me "/tmp", then I went to the .lc file and added this: but didn't work. – kexxcream Nov 05 '13 at 15:23
  • Can you read the session ID on PHP and use that in LiveCode? Perhaps you could store that ID on the user's computer in a cookie when you make the actual system. In LiveCode, you can set the sessionID property. There is also a sessionName property and PHP has a session_name() function. – Mark Nov 05 '13 at 17:14