I currently am using ls 2.06
I need to add tokens as people do the survey, I used to do this via the newtoken.php workaround
I have 2 surveys.....that need to to be connected via a token
I am trying to figure out the remote control feature but I am totally lost.
I have setup survey one to require registration, which creates a token, I would like then to pass this token to survey2 .
Is this possible? usnig end url something like ....
<?php
require_once 'jsonRPCClient.php';
define( 'LS_BASEURL', '/index.php/');
define( 'LS_USER', '****' );
define( 'LS_PASSWORD', '****' );
$iSurveyID = 375394;
$token = 'ABCDE';
// Instantiate a new RPC client
$myJSONRPCClient = new jsonRPCClient(LS_BASEURL.'admin/remotecontrol');
// Get a session key
$sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
// Define the token params
$tokenParams = array("token"=>$token,"language"=>'fr',"emailstatus"=>"OK");
$aParticipantData=array($tokenParams);
$bCreateToken = true;
// Create the tokens
$newToken = $myJSONRPCClient->add_participants( $sSessionKey, $iSurveyID, $aParticipantData, $bCreateToken);
// Print returned results
echo '<hr><br><h1>Limesurvey</h1><br>New token created in survey '.$iSurveyID.':'
.'<ul>'
.'<li>TID - '.$newToken[0].'</li>'
.'<li>Token - '.$newToken[0].'</li>'
.'</ul>';
// Send an invitation to the created token
$tokenIDs = array($newToken[0]);
$newMail = $myJSONRPCClient->invite_participants($sSessionKey, $iSurveyID, $tokenIDs, true);
// Print returned results
if($newMail[$newToken[0]] == 'OK') {
echo 'Invitation sent to:'
.'<ul>'
.'<li>Name - '.$newMail[$newToken[0]].'</li>'
.'<li>Email - '.$newMail[$newToken[0]].'</li>'
.'</ul>';
}
else {
echo 'Error - no invitation sent!';
}
// Release the session key
$myJSONRPCClient->release_session_key( $sSessionKey );
?>
I need to add tokens as people do the survey, I used to do this via the newtoken.php workaround
I have 2 surveys.....that need to to be connected via a token
I am trying to figure out the remote control feature but I am totally lost.
I have setup survey one to require registration, which creates a token, I would like then to pass this token to survey2 .
Is this possible? usnig end url something like ....
<?php
require_once 'jsonRPCClient.php';
define( 'LS_BASEURL', '/index.php/');
define( 'LS_USER', '****' );
define( 'LS_PASSWORD', '****' );
$iSurveyID = 375394;
$token = 'ABCDE';
// Instantiate a new RPC client
$myJSONRPCClient = new jsonRPCClient(LS_BASEURL.'admin/remotecontrol');
// Get a session key
$sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
// Define the token params
$tokenParams = array("token"=>$token,"language"=>'fr',"emailstatus"=>"OK");
$aParticipantData=array($tokenParams);
$bCreateToken = true;
// Create the tokens
$newToken = $myJSONRPCClient->add_participants( $sSessionKey, $iSurveyID, $aParticipantData, $bCreateToken);
// Print returned results
echo '<hr><br><h1>Limesurvey</h1><br>New token created in survey '.$iSurveyID.':'
.'<ul>'
.'<li>TID - '.$newToken[0].'</li>'
.'<li>Token - '.$newToken[0].'</li>'
.'</ul>';
// Send an invitation to the created token
$tokenIDs = array($newToken[0]);
$newMail = $myJSONRPCClient->invite_participants($sSessionKey, $iSurveyID, $tokenIDs, true);
// Print returned results
if($newMail[$newToken[0]] == 'OK') {
echo 'Invitation sent to:'
.'<ul>'
.'<li>Name - '.$newMail[$newToken[0]].'</li>'
.'<li>Email - '.$newMail[$newToken[0]].'</li>'
.'</ul>';
}
else {
echo 'Error - no invitation sent!';
}
// Release the session key
$myJSONRPCClient->release_session_key( $sSessionKey );
?>