flipminds/gotowebinar

GotoWebinar REST API 包装器。使用新的 api.getgo.com/G2W/rest 端点。

v1.0.3 2017-09-18 19:18 UTC

This package is not auto-updated.

Last update: 2024-09-18 21:18:20 UTC


README

描述

这是一个围绕 GotoWebinar API(GotoWebinar API)的简单包装。

使用 Composer 安装

我们建议使用 Composer 安装此包。

在项目根目录下运行

composer require flipminds/gotowebinar:~1.0.0

简单用法

use FlipMinds\GotoWebinar\GotoWebinar;
  
$credentials = [
    'username' => ''
    'password' => ''
    'consumerKey' => ''
];
 
$gtw = new GotoWebinar($credentials);
 
$webinars = $gtw->getUpcoming();
  
$key = ''
foreach($webinars as $webinar) { 
    if (!$key) $key = $webinar->webinarKey;
}
 
$result = $gtw->createRegistrant($key, 'firstname','lastname','email);
print_r($result);

查看示例文件夹以获取更多用法示例。

缓存认证令牌

默认情况下,GotoWebinar 认证令牌有效期为 356 天。缓存令牌可以减少一次往返 GotoWebinar 服务器的次数。

您可以使用 getAuth() 方法调用检索可以缓存的数组。您可以将此数组作为构造函数的第二个参数使用。

您还可以设置一个回调来捕获认证后 GotoWebinar 服务器上的认证数组。

// $auth =  getfromcache()
   
$gtw = new GotoWebinar($credentials, $auth); // see Above
 
$gtw->setAuthCallback(function($auth) {
 // save $auth to cache 
});