api request for login adobe connect in php

748 Views Asked by At

im try the request api for login in adobe connect until the my user don't need to login and automatic go to class link,i according the adobe connect use 2 way to request but I went right until the end but go to class link ,redirect to login page i do not know my problem

text in adobe connect for login:

Log in to an Adobe Connect hosted account with an account ID 1 Before you log the user in, call common-info with the domain name of your Adobe Connect hosted account in either the request URL or the domain parameter: http://acme.adobe.com/api/xml?action=common-info http://adobe.com/api/xml?action=common-info&domain=acme.adobe.com Last updated 9/4/2013 USING ADOBE CONNECT 9 WEB SERVICES 12 Login and requests 2 Parse the response for the values of cookie and account-id: Sbreezzd2dfr2ua5gscogv ... 3 Collect the user’s login ID and password in your application. 4 Call the login action, adding the user’s credentials and the account-id and session parameters: https://example.com/api/xml?action=login&[email protected] &password=happy&account-id=295153&session=Sbreezzd2dfr2ua5gscogv 5 Parse the response for a status code of ok. 6 (Optional) If you prefer, you can call login before common-info, extract the cookie value from the response header, and manage it yourself or using a cookie management library.

$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&[email protected]&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();
2

There are 2 best solutions below

0
On

Today I found your question and it helped me to login to Adobe Connect with PHP. I have solved your problem by passing the session parameter to the meeting URL. Surely you would already find the problem, but I write it in case it helps someone. Greetings

$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&[email protected]&password=1234&session=".$session;
$response2 = file_get_contents($link_login);    

 header("Location:  http://serverconnect/meetingurl/?session=".$session);
 die();
0
On

Adobe Connect uses cookies to log in. curl library supports the cookies and can store them in a file. The following function creates .keep.cookie.log file beside your PHP file and saves cookie info. At the end of the function simplexml_load_string is used to parse the answer.

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;
}

An example of using the AdobeConnectAPI function to reading the recording list of Adobe Connect for a specific session:

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>';
}