Copyright © 2011 Kaltura Inc.
All Rights Reserved. Designated trademarks and brands are the property of their respective owners.
Use of this web site constitutes acceptance of the Terms of Use and Privacy Policy.
EduVideo.org
Is there any link or documentation out there that shows how to setup a BASIC user session in PHP?
All I'm trying to do is execute a playlist to get the XML and I can't even figure out how to get started.
Thanks for the response MellowK. I tried that but it's not working and I believe it's because of my included files. I downloaded the PHP library and where you had:
require_once "KalturaClient.php";
I put in the client file that came with the zip. Is that what you meant with that? It seems to be choking on my serviceUrl.
I use a sub domain so if to access my Kaltura server on ww2.domain.com would I use that as a serviceUrl or the full path of ww2.domain.com/kalturaCE.
The page that uses your example is on a different domain, is it still possible to negotiate with the api?
UPDATE: I'm able to POST to my api and receive a generated user KS but not with that example script. The exact error is:
Warning: Missing argument 2 for KalturaConfiguration::__construct(), called in /listPlaylist.php on line 9 and defined in kaltura_client_base.php on line 233
Fatal error: Call to a member function start() on a non-object in /listPlaylist.php on line 11
The file to include is called KalturaClient.php. If it has another name, then you are using the wrong zip file.
If you know the name of the admin user, you can use that name instead of that made up one.
Here's a revised sample. You can put the domain name of your site as the serviceUrl in the appropriate line indicated.
If your CE site responds from 'http://youdomain.com/kmc" then you should use "http://yourdomain.com" for
the serviceUrl.
require_once "KalturaClient.php";
$user = "SomeoneWeKnow";
$kconf = new KalturaConfiguration(PARTNER_ID);
// If you want to use the API against your self-hosted CE,
// go to your KMC and look at Settings -> Integration Settings to find your partner credentials
// and add them above. Then insert the domain name of your CE below.
// $kconf->serviceUrl = "http://www.mySelfHostedCEsite.com/";
$kclient = new KalturaClient($kconf);
$ksession = $kclient->session->start(ADMIN_SECRET, $user, KalturaSessionType::ADMIN);
if (!isset($ksession)) {
die("Could not establish Kaltura session. Please verify that you are using valid Kaltura partner credentials.");
}
$kclient->setKs($ksession);
// Set the response format
// KALTURA_SERVICE_FORMAT_JSON json
// KALTURA_SERVICE_FORMAT_XML xml
// KALTURA_SERVICE_FORMAT_PHP php
$kconf->format = KalturaClientBase::KALTURA_SERVICE_FORMAT_PHP;
$kfilter = new KalturaPlaylistFilter();
$kfilter->orderBy = KalturaPlaylistOrderBy::NAME_ASC;
$result = $kclient->playlist->listAction($kfilter);
echo "<h1>Playlist result structure</h1>";
echo '<pre>';
print_r($result);
echo '</pre>';
You may want to enclose the final print_r($result) statement like this:
One other question when you define the user, is that supposed to be the name you used when you registered the account on your server? For example if I set mine up to be admin, would you swap "SomeoneWeKnow" for "admin"?
Using the api, you don't have to start any session, just execute the playlist via the api URL and you'll get the XML string in return
Try this:
// List Playlists
// Your Kaltura partner credentials
define("PARTNER_ID", "nnnnnn");
define("ADMIN_SECRET", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
define("USER_SECRET", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
require_once "KalturaClient.php";
$user = "SomeoneWeKnow";
$kconf = new KalturaConfiguration(PARTNER_ID);
$kclient = new KalturaClient($kconf);
$ksession = $kclient->session->start(ADMIN_SECRET, $user, KalturaSessionType::ADMIN);
if (!isset($ksession)) {
die("Could not establish Kaltura session. Please verify that you are using valid Kaltura partner credentials.");
}
$kclient->setKs($ksession);
// Set the response format
// KALTURA_SERVICE_FORMAT_JSON json
// KALTURA_SERVICE_FORMAT_XML xml
// KALTURA_SERVICE_FORMAT_PHP php
$kconf->format = KalturaClientBase::KALTURA_SERVICE_FORMAT_XML;
$kfilter = new KalturaPlaylistFilter();
$kfilter->orderBy = KalturaPlaylistOrderBy::NAME_ASC;
$result = $kclient->playlist->listAction($kfilter);
echo "<h1>Playlist result structure</h1>";
print_r($result);
?>