[luci] How to make a request and catch its response (in JSON format)?

Bryan Mayland bmayland at leoninedev.com
Thu Aug 9 15:30:51 CEST 2012


On 8/9/2012 4:13 AM, Duy Nguyen wrote:
> I am now stuck in using LuCi API to write a controller to make a 
> request to a certain page asynchronously, and then catch its response 
> (in JSON format) for further processing.
>
> I am a very newbie to LuCi so I really need help.
>
> Hope that there will be someone who knows how to deal with my problem.
You can find several examples of doing synchronous JSON requesting and 
parsin by googling "luci require httpclient", but if you need to do it 
asynchronously you'll need to tell us when exactly you're trying to do 
what. Asynchronous to what?

Here are some good examples of synchronous JSON from the fonera folks:
http://svn.fonosfera.org/fon-ng/trunk/luci/libs/uploadd/luasrc/fon/facebook.lua
http://svn.fonosfera.org/fon-ng/trunk/luci/applications/luci-torrent/luasrc/transmission.lua


More information about the luci mailing list