在 PHP 中登录 Adobe Connect 的 API 请求



im 尝试请求 API 在 Adobe Connect 中登录,直到我的用户不需要登录并自动转到类链接,我根据 Adobe Connect 使用 2 方式请求但我一直走到最后但转到类链接,重定向到登录页面 我不知道我的问题

用于登录的 Adobe Connect 中的文本:

使用帐户 ID 登录到 Adobe Connect 托管帐户 1 在登录用户之前,请在请求 URL 或域参数中使用您的 Adobe Connect 托管帐户的域名调用 common-info: http://acme.adobe.com/api/xml?action=common-info http://adobe.com/api/xml?action=common-info&domain=acme.adobe.com 最后更新 9/4/2013 使用 ADOBE CONNECT 9 WEB 服务 12 登录和请求 2 解析 cookie 和帐户 ID 值的响应: Sbreezzd2dfr2ua5gscogv ... 3 在您的应用程序中收集用户的登录ID和密码。 4 调用登录操作,添加用户的凭据以及帐户 ID 和会话参数: https://example.com/api/xml?action=login&login=joy@acme.com &password=happy&account-id=295153&session=Sbreezzd2dfr2ua5gscogv 5 分析响应的状态代码为 ok。 6(可选(如果您愿意,可以在 common-info 之前调用 login,从响应中提取 cookie 值 标头,并自行管理或使用 Cookie 管理库进行管理。

$class_link = "http://185.50.145.230/academy9"
$response = file_get_contents("http://185.53.140.234/api/xml?action=common-info");
$result = simplexml_load_string($body);
$value = $result->common->cookie;
$session = (string)$value;
$account = $result->common->account->attributes()->{'account-id'};
$account_id = (int)$account;
$link = "https://185.50.145.230/api/xmlaction=login&login=alinadi14@gmail.com&password=123456&accountid=".$account_id."&session=".$session;
$response2 = file_get_contents($link);
$_SESSION['BREEZESESSION'] = $session;
header("Set-Cookie: BREEZESESSION=".$session);
header("Location: ". $class_link);
die();

今天我发现了你的问题,它帮助我用PHP登录Adobe Connect。我已经通过将会话参数传递给会议 URL 解决了您的问题。 当然,您已经发现了问题所在,但是我写它以防万一它对某人有所帮助。 问候

$response = file_get_contents("https://serverconnect/api/xml?action=common-info");
$result = simplexml_load_string($response);
$session = $result->common->cookie;    

$link_login = "https://serverconnect/api/xml?action=login&login=user@email.com&password=1234&session=".$session;
$response2 = file_get_contents($link_login);    
header("Location:  http://serverconnect/meetingurl/?session=".$session);
die();

Adobe Connect 使用 cookie 登录。curl库支持 cookie,并可以将它们存储在文件中。 以下函数在您的 PHP 文件旁边创建.keep.cookie.log文件并保存 cookie 信息。 在函数的末尾,simplexml_load_string用于解析答案。

define('HOST_URL', 'http://255.255.255.255');
function AdobeConnectAPI($params)
{
$cookie_file = __DIR__ . '/.keep.cookie.log';
$ch = curl_init(HOST_URL . '/api/xml?' . http_build_query($params));
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
$output = simplexml_load_string($output) or die('Problem');
return $output;
}

使用AdobeConnectAPI函数读取特定会话的 Adobe Connect 录制文件列表的示例:

AdobeConnectAPI([
'action' => 'login', 
'login' => 'USERNAME', // your username
'password' => 'PASSWORD' // your password
]);

$recordings_list = AdobeConnectAPI([
'action' => 'sco-contents', 
'sco-id' => 676501 // class sco-id
]);

AdobeConnectAPI([
'action' => 'logout'
]);
foreach (((array)$recordings_list->scos)['sco'] as $recording) {
echo HOST_URL . $recording->{'url-path'} . '<br>';
}

最新更新