Esempio n. 1
0
#!/usr/bin/php
<?php 
// Fetch the auth tokens for the GoToWebinar product
// Send webinar details in array
// Return value:      [webinarKey] => 3409050463727985163
include "citrix_auth.php";
$tokenAry = getAuthToken("gtw");
$webinarDetails = array("subject" => "Test of GTW API", "description" => "This is the description of the test webinar", "times" => array(array("startTime" => date("c", mktime(9, 22, 0, 12, 25, 2015)), "endTime" => date("c", mktime(10, 22, 0, 12, 25, 2015)))), "timeZone" => "");
$mtgAry = createWebinar($tokenAry, $webinarDetails);
print_r($mtgAry);
// =========================================================================
//    Create a GTM webinar
function createWebinar($tokenAry, $webinarDetails)
{
    $accessToken = $tokenAry['access_token'];
    $organizerKey = $tokenAry['organizer_key'];
    $webinarInfo = json_encode($webinarDetails);
    $ch = curl_init();
    $url = "https://api.citrixonline.com:443/G2W/rest/organizers/" . $organizerKey . "/webinars";
    $headers = array("Authorization: " . $accessToken, "Accept: application/json", "Content-Type: application/json; charset=UTF-8", "Content-Length: " . strlen($webinarInfo));
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
    curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $webinarInfo);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    # required for https urls
Esempio n. 2
0
<?php

include "../init.php";
include "../db_config.php";
$db = mysqli_connect($dbserver, $dbuser, $dbpass, $dbname);
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
drawPage();
if (isset($_POST['title'])) {
    createWebinar();
}
// =========================================================
/** 
 *  Draw the HTML form
 */
function drawPage()
{
    ?>
<!DOCTYPE html>
<html>
<head>
<title>Create a Webinar Event</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();