PHP code example of evently / limeremote

1. Go to this page and download the library: Download evently/limeremote library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

evently / limeremote example snippets


// First create a new remote with your user, password, remote control url and optionally a survey id.
// The plugin creates a new remote and automatically gets a session key to communicate with Limesurvey
$remote = new LimeRemote('admin', 'password', 'https://www.limesurvey.com/admin/remotecontrol',123456);

// Use any of the functions, optionally passing variables to the remote
$surveys = $remote->listSurveys();

/*
Results in:

array:26 [
  0 => array:5 [
    "sid" => "123456"
    "surveyls_title" => "First Survey"
    "startdate" => null
    "expires" => null
    "active" => "Y"
  ]
  1 => array:5 [
    "sid" => "123457"
    "surveyls_title" => "Second Survey"
    "startdate" => null
    "expires" => null
    "active" => "N"
  ]

*/



// To use the genericRemoteQuery pass the action you want to trigger with the necessary variables
// For instance, the list_participants action accepts start and limit, and optionally an unused boolean, an array of attributes to get and and array of conditions. So:
$participant = $remote->genericRemoteQuery('list_participants', [123456,0,50,true])
// will get the 50 first unused tokens
/*
array:50 [▼
  0 => array:3 [▼
    "tid" => "1"
    "token" => "abcdefghijklmn"
    "participant_info" => array:3 [▼
      "firstname" => "Jane"
      "lastname" => "Doe"
      "email" => "[email protected]"
    ]
  ]
  1 => array:3 [▼
    "tid" => "2"
    "token" => "opqrstuvwxyzab"
    "participant_info" => array:3 [▶]
  ]


*/


$timeline = $remote->getLastNumDaysTimeline(8)

/*
will result in
array:6 [▼
  "2019-01-01" => 23
  "2019-01-02" => 15
  "2019-01-03" => 41
  "2019-01-04" => 28
  "2019-01-05" => 12
  "2019-01-06" => 5
]

*/