- Posts: 13726
- Thank you received: 4203
Ask the community, share ideas, and connect with other LimeSurvey users!
<?php require_once 'jsonrpcphp/JsonRPCClient.php'; define( 'LS_BASEURL', 'https://www.myServer.de/limesurvey'); // adjust this one to your actual LimeSurvey URL define( 'LS_USER', 'username' ); define( 'LS_PASSWORD', 'password' ); $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(); } // Here I use GET parameters $survey_id = $_GET['SID']; $firstName = $_GET['NOMBRE']; $lastName = $_GET['APELLIDO']; $email = $_GET['EMAIL']; $atokenParams = array("email"=>$email,"lastname"=>$lastName,"firstname"=>$firstName,"token"=>$token,"emailstatus"=>"OK"); $aParticipantData=array($atokenParams); $bCreateToken = true; // Create the token in survey $newToken = $myJSONRPCClient->add_participants( $sessionKey, $survey_id, $aParticipantData, $bCreateToken); // If token successfully created, redirect to survey if(isset($newToken[0]['tid']) AND isset($newToken[0]['token'])) { $link='www.myServer.de/limesurvey/index.php/'.$survey_id.'?token='.$newtoken[0]['token']; // Here you may send the link to the participant } // Otherwise, display errors else if (isset($newToken['status'])) { echo $newToken['status']; } else { echo '<br />'; echo 'Error: '.$newToken[0]['errors']['token'][0]; } // release the session key $myJSONRPCClient->release_session_key( $sessionKey ); ?>
Please Log in to join the conversation.
Please Log in to join the conversation.
Nada; esto está configurado en LimeSurvey.qué le debe agregar el CRM al link de la encuesta
Please Log in to join the conversation.