forked from teodortalov/citrix
-
Notifications
You must be signed in to change notification settings - Fork 2
/
examples.php
45 lines (31 loc) · 1.21 KB
/
examples.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'vendor/autoload.php';
//authenticate with direct authentication
$client = new \Citrix\Authentication\Direct('CONSUMER_KEY');
$client->auth('USERNAME', 'PASSWORD');
//get upcoming weibnars
$goToWebinar = new \Citrix\GoToWebinar($client);
$webinars = $goToWebinar->getUpcoming();
//get info for a single webinar
/* @var $webinar \Citrix\Entity\Webinar */
$webinar = reset($webinars);
//get registraion/join url
$registrationUrl = $webinar->getRegistrationUrl();
//get more info about a webinar
$webinarInfo = $goToWebinar->getWebinar($webinar->getId());
//get registrants for given webinar
$registrants = $webinar->getRegistrants();
//register a user for a webinar
$data = array('email' => '[email protected]', 'firstName' => 'Teodor', 'lastName' => 'Talov');
$consumer = new \Citrix\Entity\Consumer($client);
$consumer->setData($data)->populate();
$registration = $webinar->registerConsumer($consumer);
if ($registration->hasErrors()) {
throw new \Citrix\Exception\ServiceException($registration->getError());
}
var_dump('You just registered!');
//get past weibnars
$goToWebinar = new \Citrix\GoToWebinar($client);
$webinars = $goToWebinar->getPast();