Returning information from LUA to PHP

Please post here if you have problems in using Wing FTP Server.
Post Reply
StenAaboHansen
Posts: 40
Joined: Mon Feb 09, 2015 8:50 pm

Returning information from LUA to PHP

Post 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.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Returning information from LUA to PHP

Post 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);

?>
StenAaboHansen
Posts: 40
Joined: Mon Feb 09, 2015 8:50 pm

Re: Returning information from LUA to PHP

Post by StenAaboHansen »

Hello

Thanks, I got the clue

Regards
Sten
Post Reply