Page 1 of 1

Returning information from LUA to PHP

Posted: Mon Feb 09, 2015 9:05 pm
by StenAaboHansen
Is it possible to return information from LUA script to PHP.

I am trying to test if a group exist with the following line

$strLuaScript_Group = "c_GroupExist('".$s_domain."','".$s_group."')";

but I get nothing back.

Re: Returning information from LUA to PHP

Posted: Wed Feb 11, 2015 4:33 am
by FTP
Here is an example for the PHP script:

Code: Select all

<?php

$strUrl = "http://127.0.0.1:5466/admin_webservice.html"; 
$strUrlParam = "?admin=demo&pass=demo&cmd=";
$s_domain = "domain1";
$s_group = "group111";
$strLuaScript = "local bExist = c_GroupExist('".$s_domain."','".$s_group."') if bExist then print('yes') else print('no') end "; 
 
$strResult = file_get_contents($strUrl.$strUrlParam.rawurlencode($strLuaScript));
print($strResult);

?>

Re: Returning information from LUA to PHP

Posted: Wed Feb 11, 2015 2:48 pm
by StenAaboHansen
Hello

Thanks, I got the clue

Regards
Sten