【问题标题】:error in go to webinar rest citrix api转到网络研讨会休息 citrix api 时出错
【发布时间】:2013-09-10 06:30:23
【问题描述】:

我尝试将寄存器从详细信息连接到 goto-webinar API。我得到了一些代码,如下所示,当我执行这段代码时,我得到了一些错误

<?php
$email = "n.manoj25@gmail.com";
$firstname = "manoj";
$lastname = "kumar";

class ApiClient {

private $oauthToken;

public function __construct($oauthToken) {
    $this->oauthToken = $oauthToken;
}

public function post($url, $data) {
    $data_string = json_encode($data);   

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

    curl_setopt($ch, CURLOPT_TIMEOUT, '10');

    $headers = array(
            "Content-Type: application/json",
            "Accept: application/json",
            "Authorization: OAuth oauth_token={$this->oauthToken}",
            "Content-Length: " . strlen($data_string)
        );
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 

    $ret = curl_exec($ch);

    return json_decode($ret);
}

public function get($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, '10');

    $headers = array(
            "Content-Type: application/json",
            "Accept: application/json",
            "Authorization: OAuth oauth_token={$this->oauthToken}"
        );
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 

    $ret = curl_exec($ch);

    return json_decode($ret);
}

}

class Webinar {

private $developerKey;
private $organizerKey;
protected $client;
// ##########################
private $apps = array(
    'MMT' => array(
        'developerKey' => '155834115',
        'oauthToken' => '',
        'organizerKey' => '')
);

public function __construct($app = 'MMT') {
    if(!array_key_exists($app, $this->apps)) {
        throw new Exception('Invalid argument: unknown developer key');
    }
    $this->developerKey = $this->apps[$app]['developerKey'];
    $this->organizerKey = $this->apps[$app]['organizerKey'];
    $this->client = new ApiClient($this->apps[$app]['oauthToken']);
}


public function getUpcoming() {
    return $this->client->get("https://api.citrixonline.com/G2W/rest/organizers/{$this->organizerKey}/upcomingWebinars");
}

public function getHistorical() {
    return $this->client->get("https://api.citrixonline.com/G2W/rest/organizers/{$this->organizerKey}/historicalWebinars");
}

public function addRegistrant($webinarKey, $email, $firstname, $lastname) {
    $url = "https://api.citrixonline.com/G2W/rest/organizers/{$this->organizerKey}/webinars/{$webinarKey}/registrants";
    $data = (object) array(
        'firstName' => $firstname,
        'lastName' => $lastname,
        'email' => $email
    );
    return $this->client->post($url, $data);
}

}

 //****************************************************

 $api = new Webinar();
 print_r($api->addRegistrant);
?>

这是我遇到的错误

注意:未定义属性:C:\wamp\www\webinar_2\new_api.php 中的 Webinar::$addRegistrant 位于第 105 行

任何人都知道如何解决这个错误

【问题讨论】:

    标签: php api citrix webinar


    【解决方案1】:

    答案有点晚,但您正在尝试打印属性并且没有调用您定义的方法。这是一个 php 问题,而不是 citrix 问题。

    【讨论】:

      【解决方案2】:

      我的回复也晚了,但经过一些黑客攻击后,我找到了一个非常简单的方法来call the CITRIX API via PHP to register a new GotoWebinar attendee

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-08-10
        • 2013-01-24
        • 1970-01-01
        • 2011-11-24
        • 1970-01-01
        相关资源
        最近更新 更多