Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition, Versión 5.6.26+230613
Own server or LimeSurvey hosting: Own server
Survey theme/template:
==================
Hello
I am trying to create a script to copy a survey using remotecontrol. I have installed the jsonrpcphp library in this directory: /code/limesurvey/third_party/jsonrpcphp
and I include it in my script:
require_once __DIR__ . '/../../third_party/jsonrpcphp/src/org/jsonrpcphp/JsonRPCClient.php';
I set the address and access parameters:
define( 'LS_RPCURL', '
mysite.com/index.php/admin/remotecontrol
');
define( 'LS_USER', 'admin' );
define( 'LS_PASSWORD', 'mypassword' );
I create the client:
$myJSONRPCClient = new $myJSONRPCClient( LS_RPCURL );
I create the session key:
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
And run the function to copy a poll from another one:
$result = $myJSONRPCClient->copy_survey($sessionKey, 111, 'Copy survey 111');
I also need to set the ID of the new survey. According to the documentation (
api.limesurvey.org/classes/remotecontrol...l#method_copy_survey
), it is possible to send another parameter with the ID of the new survey:
$result = $myJSONRPCClient->copy_survey($sessionKey, 111, 'Copy survey 111', 222);
But it doesn't work... It creates the survey with a different ID than desired (222 in the example). In the documentation (
api.limesurvey.org/classes/remotecontrol...l#method_copy_survey
), it says that the file remotecontrol_handle.php is in the path application/helpers/remotecontrol. But when editing the file, I see that the copy_survey function does not receive that fourth parameter: the id of the new poll:
public function copy_survey($sSessionKey, $iSurveyID_org, $sNewname).
Maybe I don't have the correct version of remotecontrol_handle.php?
Thanks for your help