1. Go to this page and download the library: Download causal/doodle_client 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/ */
causal / doodle_client example snippets
$doodleUsername = '[email protected]';
$doodlePassword = 'my-very-secret-password';
$client = new \Causal\DoodleClient\Client($doodleUsername, $doodlePassword);
$client->connect();
$myPolls = $client->getPersonalPolls();
echo '<h1>My polls</h1>';
echo '<ul>';
foreach ($myPolls as $poll) {
echo '<li>';
echo '<a href="' . htmlspecialchars($poll->getPublicUrl()) . '">' . htmlspecialchars($poll->getTitle()) . '</a>';
echo '<blockquote>' . nl2br($poll->getDescription()) . '</blockquote>';
echo 'Export answers as: ' .
'<a href="' . htmlspecialchars($poll->getExportExcelUrl()) . '">Excel</a> | ' .
'<a href="' . htmlspecialchars($poll->getExportPdfUrl()) . '">PDF</a>';
echo '</li>';
}
echo '</ul>';
// Optional, if you want to prevent actually authenticating over and over again
// with future requests (thus reusing the local authentication cookies)
$client->disconnect();
// Selection of a given poll could be based on any "$poll" from the
// foreach loop in "Basic Usage" example.
echo '<table>';
echo '<thead>';
echo '<tr>';
echo '<th></th>';
$options = $poll->getOptions();
foreach ($options as $option) {
echo '<th>' . htmlspecialchars($option) . '</th>';
}
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$participants = $poll->getParticipants();
foreach ($participants as $participant) {
echo '<tr>';
echo '<td>' . htmlspecialchars($participant->getName()) . '</td>';
foreach ($participant->getPreferences() as $preference) {
switch ($preference) {
case '0':
$value = 'NO';
$color = '#ffccca';
break;
case '1':
$value = 'YES';
$color = '#d1f3d1';
break;
case '2':
$value = 'If needed';
$color = '#ffeda1';
break;
default:
$value = '?';
$color = '#eaeaea';
break;
}
echo '<td style="background-color:' . $color . '">' . htmlspecialchars($value) . '</td>';
}
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.