<?php

require_once './jsonrpcphp/includes/jsonRPCClient.php';

// define( 'LS_BASEURL', 'http://172.21.156.16/limesurvey/index.php');  // adjust this one to your actual LimeSurvey URL
define( 'LS_BASEURL', 'http://demo.limesurvey.org/index.php');  // adjust this one to your actual LimeSurvey URL

// define( 'LS_USER', 'rails_user' );
define( 'LS_USER', 'admin' );

// define( 'LS_PASSWORD', 'limoncello' );
define( 'LS_PASSWORD', 'test' );

// the survey to process

// $survey_id=545515;
$survey_id=367177;

// instanciate a new client

// $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/admin/remotecontrol' );
$myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'?r=admin/remotecontrol' );

// receive session key

$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );

$aTokenProperties = ['tid','token','completed','participant_id','language','usesleft','firstname','blacklisted','validfrom','lastname','sent','validuntil','email','remindersent','mpid','emailstatus','remindercount'];

// print_r($aTokenProperties, null );
// $result = $myJSONRPCClient->get_participant_properties( $sessionKey, 545515, 1, $aTokenProperties );
// $result = $myJSONRPCClient->get_participant_properties( $sessionKey, 545515, 5, ['tid','token'] );
$result = $myJSONRPCClient->get_participant_properties( $sessionKey, 157162, 1, $aTokenProperties );
// $result = $myJSONRPCClient->get_survey_properties( $sessionKey, 367177, ['sid','language'] );

print_r($result, null );

// release the session key

$myJSONRPCClient->release_session_key( $sessionKey );

?>
