Using PHP to Interact with the LimeSurvey RemoteControl API

The LimeSurvey RemoteControl API is a XML/JSON-RPC based web service available in LimeSurvey 2.0 that offers various API functions. The API allows for developers to control specific functionality of LimeSurvey from another application, without having to use the PHP language. However, I will be using PHP and JSON-RPC for my examples in this post.

Note: You must have the RPC interface enabled first! You can enable RPC in Configuration > Global Settings > Interfaces.

In an effort to reduce code, I will be utilizing a light-weight JSON RPC client. The dependency can be required in Composer via:

Now that I have the dependency required, I can begin to write code. The code that follows in this example will download responses for a survey and save them in a file.

This is just a small example of what can be accomplished with what the API has to offer. This code could be modified to automate downloading several surveys. You can learn much, much more about the RemoteControl API over at LimeSurvey.