Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
// Upload a file to the KMC
// Your Kaltura partner credentials
define("PARTNER_ID", "nnnnnn");
define("ADMIN_SECRET", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
define("USER_SECRET", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
require_once "KalturaClient.php";
$user = "SomeoneWeKnow"; // If this user does not exist in your KMC, then it will be created.
$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, PARTNER_ID);
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;
$movie = "piano.m4v";
$token = $kclient->media->upload($movie);
$entry = new KalturaMediaEntry();
$entry->name = "Fun Piano";
$entry->mediaType = KalturaMediaType::VIDEO;
$result = $kclient->media->addFromUploadedFile($entry, $token);
echo '<h3>Media entry structure returned</h3>';
echo '<pre>';
print_r($result);
echo '</pre>';
?>