- Posts: 36
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
RPC interface enabled:JSON-RPCDid you enable it in Global settings --> Interfaces?
Did you copy the access URL given there?
- www.limesurvey.org/manual/Global_settings#Interfaces
Please Log in to join the conversation.
Please Log in to join the conversation.
<?php require_once 'jsonrpcphp/JsonRPCClient.php'; define( 'LS_BASEURL', 'https://www.myserver.de/survey'); // adjust this one to your actual LimeSurvey URL define( 'LS_USER', 'myUser' ); define( 'LS_PASSWORD', 'myPassword' ); // the survey to process $survey_id=123456; // instantiate a new client $myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' ); // receive session key $sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); if(is_array($sessionKey)) { header("Content-type: application/json"); echo json_encode($sessionKey); die(); } $groups = $myJSONRPCClient->list_groups( $sessionKey, $survey_id ); if(is_array($groups)) { // Oops, print any errors print_r($groups); } else { // Decode the retuned base-64 string and convert to an array $decodedString = base64_decode($groups); $aResponses = json_decode($decodedString, True); echo "<pre>"; print_r($aResponses); echo "</pre>"; } // release the session key $myJSONRPCClient->release_session_key( $sessionKey ); ?>
Please Log in to join the conversation.
I have a couple of questions.Hi,
I do not see any issue with this:
Code:<?php require_once 'jsonrpcphp/JsonRPCClient.php'; define( 'LS_BASEURL', 'https://www.myserver.de/survey'); // adjust this one to your actual LimeSurvey URL define( 'LS_USER', 'myUser' ); define( 'LS_PASSWORD', 'myPassword' ); // the survey to process $survey_id=123456; // instantiate a new client $myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' ); // receive session key $sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); if(is_array($sessionKey)) { header("Content-type: application/json"); echo json_encode($sessionKey); die(); } $groups = $myJSONRPCClient->list_groups( $sessionKey, $survey_id ); if(is_array($groups)) { // Oops, print any errors print_r($groups); } else { // Decode the retuned base-64 string and convert to an array $decodedString = base64_decode($groups); $aResponses = json_decode($decodedString, True); echo "<pre>"; print_r($aResponses); echo "</pre>"; } // release the session key $myJSONRPCClient->release_session_key( $sessionKey ); ?>
Joffm
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.