$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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。