如何通过PHP调用CITRIX(LogMeIn)API来注册新的GotoWebinar与会者?

我使用以下代码用户注册到网络研讨会:

   $headers = array(
 'HTTP/1.1',
  'Accept: application/json',
  'Accept: application/vnd.citrix.g2wapi-v1.1+json',
  'Content-Type: application/json',
  'Authorization: OAuth oauth_token='.$access_token,
  'Name_First:test',
  'Name_Last:ank',
  'Email:ankinfo@yahoo.com',
   );

 $gtw_url = "https://api.citrixonline.com/G2W/rest/organizers/{organizerkey}/webinars/{webinarkey}/registrants";
 $curl = @curl_init();
 @curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); 
     @curl_setopt($curl, CURLOPT_URL, $gtw_url);
      @curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
     @curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     @curl_exec($curl);
     @curl_close($curl);

我已通过网络研讨会密钥和组织者密钥.我应该得到如下输出

HTTP/1.1 201 OK Content-Type: application/json
{
    "registrantKey":5678,
    "joinUrl":"https://www1.gotomeeting.com/join/123456789/5678"
}

问题是,当我运行文件时,我得到了输出

[
    {
        "registrantKey":106660361,
        "firstName":"test",
        "lastName":"1",
        "email":"rohankapoor99@yahoo.com",
        "status":"WAITING",
        "registrationDate":"2012-06-29T21:07:10Z",
        "joinUrl":"https://www1.gotomeeting.com/join/141654337/106660361",
        "timeZone":"America/Denver"
    }
]

我正在使用创建网络研讨会URL,为什么我要获取注册用户的信息?

解决方法:

<?PHP
if (isset($_POST['registration-submission'])) {
$base_url = 'https://api.citrixonline.com/G2W/rest';
$org_key = $_POST['organizer_key'];
$web_key = $_POST['webinar_key'];
$access_token = 'xxxxx';

$gtwPost = (object) array(
'firstName' => $POST['fname'],
'lastName'  => $POST['lname'],
'email'=> $POST['email'],
);
$newRegistrantFields = json_encode($gtwPost);
$headers = array(
        'HTTP/1.1',
        'Accept: application/vnd.citrix.g2wapi-v1.1+json',
        'Content-Type: application/json',
        'Authorization: OAuth oauth_token=xxxxx',
         'Content-Length:' . strlen( $newRegistrantFields )
        );


//Set POST URL for GoToWebinar
$gtw_url = $base_url.'/organizers/'.$org_key.'/webinars/'.$web_key.'/registrants?resendConfirmation=false';

//Start GoToWebinar submission

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $gtw_url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $curl, CURLOPT_POST, 1);
curl_setopt( $curl, CURLOPT_POSTFIELDS,$newRegistrantFields );
$newRegistrants = curl_exec($curl);
curl_close($curl);
$newRegistrantsArray = json_decode($newRegistrants,true);


 if( array_key_exists( 'registrantKey', $newRegistrantsArray ) && array_key_exists( 'joinUrl', $newRegistrantsArray ) ) {
    $form_data[ 'status' ] = true;
    $form_data[ 'code'   ] = $_POST[ 'Email' ] . ' successfully registered with webinar';
    $form_data[ 'error'  ] = 'E300';

    //echo json_encode( $form_data );
 //exit;
 }
}
?>

the code is not working. Please help me with this.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...