LCCS and PHP with ZendAMF

Adobe LiveCycle Collaboration Service has in its SDK examples for integration with the main languages used in web programming like PHP, Java, Python, etc.
In the Adobe documentation, it is recommended to use AMFPHP or pure PHP, but this integration can be used seamlessly together with ZendFramework (using ZendAMF)
Ryan Stewart wrote two articles that show how this implementation with PHP and REST.

A note on the article by Ryan, in Flex 4, Adobe introduced the use of swfobject, then the mode of getting the URL and pass parameters to the SWF looks like this:
[JAVASCRIPT]
var xiSwfUrlStr = “playerProductInstall.swf”;
var flashvars = {};
{
flashvars.roomURL = swfobject.getQueryParamValue(“roomURL”);
flashvars.authToken = swfobject.getQueryParamValue(“authToken”);
}
var params = {};
[/JAVASCRIPT]
In LCCS sdk, there is a file called lccs.php, just copy it to the same directory of your class zend. Then add the include in your gateway.php
[PHP]
< ?php require_once 'Zend/Amf/Server.php'; require_once 'lccs.php'; require_once 'Test.php'; /** Bootstrap */ // Instantiate server $server = new Zend_Amf_Server(); $server->setProduction(false);
$server->setClass(‘Test’);
// Handle request
echo($server->handle());
?>
[/PHP]
And this is a simple test class to call the method that returns the token for authentication
[PHP]
< ?php class Test { private $account; private $room; private $devUsername; private $devPassword; private $secret; //$accountURL = "https://collaboration.adobelivecycle.com/$account"; private $accountURL; private $roomURL; function __construct() { //for LCCS $this->account = “Your SDK account username from LCCS developer portal”;
$this->room = “The room you want to connect to”;
$this->devUsername = “Your LCCS developer account username”;
$this->devPassword = “Your LCCS developer account password”;
$this->secret = “The shared secret from the LCCS developer portal”;

//$accountURL = “https://collaboration.adobelivecycle.com/$account”;
$this->accountURL = “http://connectnow.acrobat.com/$this->account”;
$this->roomURL = “$this->accountURL/$this->room”;
}

public function getToken($data=array())
{
try
{
$this->account = new RTCAccount($this->accountURL);
$this->account->login($this->devUsername,$this->devPassword);
$session = $this->account->getSession($data[‘room’]);
$displayName = $data[‘displayName’];
$username = $data[‘username’];
$role = $data[‘role’];
$token = $session->getAuthenticationToken($this->secret, $displayName, $username, $role);
return $token;
}
catch (Exception $e)
{
throw new Exception($e->getMessage());
}
}
}
?>
[/PHP]

Was this article helpful? feel free to make a donation and help keep the blog in the air
Adobe, LCCS, PHP, ZendAMF , ,

3 comments


Leave a Reply