[luci] How to communicate with the Json Rpc API
Clemens John
clemens-john at gmx.de
Fri Aug 21 15:29:42 CEST 2009
Sorry for this question. I didn´t knew that RPC is a protocoll that needs a
special client.
Maybe you shold mention this in the howto for people who never worked with
such things.
Because I´m developing with Php I used the Client from http://jsonrpcphp.org/
My Code example to get the hostname of a router is:
require_once './lib/classes/extern/jsonRPCClient.php';
$auth = new jsonRPCClient('http://10.18.0.11/cgi-bin/luci/rpc/auth');
$token = $auth->login('root', 'yourpassword');
$sys = new jsonRPCClient('http://10.18.0.11/cgi-bin/luci/rpc/sys?auth='.
$token);
echo $sys->hostname();
I hope this might be usefull for others who have this question.
Bye
Clemens
On Wednesday 19 August 2009 13:13:00 Clemens John wrote:
> Hi,
>
> I read the Documentation on JsonRpc on http://luci.freifunk-
> halle.net/Documentation/JsonRpcHowTo but I didn´t unterstand how to do it.
>
> Basically I want to get the uptime of a machine.
> How do I do that?
>
> I tried "http://mymachiene/cgi-bin/luci/rpc/sys/uptime" in my browser but
that
> didn´t worked.
>
> Thanks
> Clemens
More information about the luci
mailing list