Hi,
I've followed the guidelines to enable json rpc here:
www.limesurvey.org/manual/RemoteControl_2_API#add_participants
I created the php example file:
<?php
// without composer this line can be used
// require_once 'path/to/your/rpcclient/jsonRPCClient.php';
// with composer support just add the autoloader
include_once 'vendor/autoload.php';
define( 'LS_BASEURL', '
xxx.be/limesurvey/
'); // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'admin' );
define( 'LS_PASSWORD', 'xxxxxx' );
// the survey to process
$survey_id=425522;
// instanciate a new client
$myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/admin/remotecontrol' );
// receive session key
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
// receive all ids and info of groups belonging to a given survey
$groups = $myJSONRPCClient->list_groups( $sessionKey, $survey_id );
print_r($groups, null );
// release the session key
$myJSONRPCClient->release_session_key( $sessionKey );
?>
But when I try to test it, I get this error:
PHP Fatal error: Uncaught exception 'Exception' with message 'Incorrect response id: (request id: 1)' in C:\Inetpub\Venice-Blog\limesurvey\vendor\weberhofer\jsonrpcphp\src\org\jsonrpcphp\JsonRPCClient.php:185
Stack trace:
#0 C:\Inetpub\Venice-Blog\limesurvey\rpc-connect.php(19): org\jsonrpcphp\JsonRPCClient->__call('get_session_key', Array)
#1 C:\Inetpub\Venice-Blog\limesurvey\rpc-connect.php(19): org\jsonrpcphp\JsonRPCClient->get_session_key('admin', 'xxx')
#2 {main}
thrown in C:\Inetpub\Venice-Blog\limesurvey\vendor\weberhofer\jsonrpcphp\src\org\jsonrpcphp\JsonRPCClient.php on line 185
Any ideas? I think the jsonrpc client package was correctly installed (and found by limesurvey). The user / password combo is correct.
I'm running Version 2.06+ Build 150911
Thanks,
Tom