Zideo API Table of Contents

Upload widget
Zideo API (Advanced)


Zideo Upload Widget
The upload widget offers possebillities to upload video from external websites. The upload widget is a optional Zideo feature and has to be activated by request. The widget is build on the Zideo Channel technology and can be extended with the channel design.\. By using the variable ext_user in the upload widget request you can make a link between the upload user and the zideo user. For example we have written a joomla component for extended use of the Upload widget.
Download
<?
global $my;
// Bert Klandermans 2008
// Zideo Media

// this is the Joomloa Upload Component
// with this script you can link the Joomla Username to the Zideo Video Username
// The uploaded videos are also uploaded to the zideo partner account
// so the partner can earn money
// This script is written for Joomla 1.x
// The automatic installation script is missing

// Installation instructions

// Create the folder com_zideoupload in the Joomla Components map
// Upload zideoupload.php to components/com_zideopload
// Replace the channel and partner id in zideoupload.php by your id's
// Add a joomla menuitem http://www.websitename/index.php?option=com_zideoupload in the joomla menu. (don't forget to use the full domain)
// en voila het werkt, in de html code van je joomla website wordt de variabele ext_user gevuld met de ingelogde joomla gebruikersnaam

echo "<iframe width=\"650\"
height=\"500\"
frameborder=\"0\"
marginwidth=\"0\"
marginheight=\"0\"
src=\"http://www.zideo.nl/gadgets/zideo_upload/index.php?channel=6c6f6f3d&partner=6d49513d&ext_user=$my->username
\">
</iframe>";
?>

Download
Zideo API
The Zideo video sharing site allows Web application developers to access public content through its developer API. The SimpleXML extension in PHP is ideal for processing the XML feeds generated by this API and using them to build customized PHP applications. This article introduces the Zideo Data API, demonstrates how you can use it to browse user-generated video content; access video metadata and perform keyword searches.

Feed URL http://www.zideo.nl/gadgets/api/api.php

Variables :

channel - contains the channel ID
partner - contains the partner ID or Username
search - contains the search string
limit - contains the number of results (max 1000 per feed)
start - contains the start page of the feed (not yet implemented)
orderby - contains the order of the feed (views, rating, date)
config - (for zideo corporate users) contains the player / config ID
zideo & playzideo - contains the video id
height - default height of the player
width - default width of the player

example 1
http://www.zideo.nl/gadgets/api/api.php?partner=hotspods&orderby=date&limit=10

example 2
http://www.zideo.nl/gadgets/api/api.php?channel=6d596556&orderby=date&limit=10

example 3
http://www.zideo.nl/gadgets/api/api.php?search=dog&orderby=views&limit=10

example 4
http://www.zideo.nl/gadgets/api/api.php?zideo=6c594b546d513d3d&playzideo=6c34655a6e46673d
Code example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Listing most viewed videos</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<?php
$feedURL = 'http://www.zideo.nl/gadgets/api/api.php?channel=6d596556&limit=10';
$sxml = simplexml_load_file($feedURL);
foreach ($sxml->entry as $entry)
{

$date= date("d-m-y", strtotime($entry->pubDate));
echo "<div class=\"title\"><a href=\"$entry->link\">$entry->title</a></div>";
echo "<table width=\"100%\"><tr><td>";
echo "<tr>";
echo "<td valign=\"top\" width=\"160\">";
echo "<a href=\"$entry->link\">";
echo "<img src=\"$entry->thumbnail\" width=\"160\" height=\"120\" border=\"0\" class=\"thumbnail\">";
echo "</a>";
echo "</td><td valign=\"top\">";
echo "Datum : $date";
echo "<br>";
echo "Door : ". $entry->author;
echo "<br>";
echo "Bekeken : ". $entry->statistics[viewCount];
echo "<br>";
echo "Lengte : ". $entry->enclosure[duration];
echo "<br>";
echo "Omschrijving<br>";
echo substr($entry->description,0,100); // sets length of description
echo "</td>";
echo "</tr>";
echo "</table>";
}
?>
</body>
</html>

Preview2
Code example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Listing most viewed videos</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<?php
$feedURL = 'http://www.zideo.nl/gadgets/api/api.php?channel=6d596556&limit=10';
$sxml = simplexml_load_file($feedURL);
foreach ($sxml->entry as $entry)
{

$date= date("d-m-y", strtotime($entry->pubDate));
echo "<div class=\"title\"><a href=\"$entry->link\">$entry->title</a></div>";
echo "<table width=\"100%\"><tr><td>";
echo "<tr>";
echo "<td valign=\"top\" width=\"160\">";
echo "<a href=\"$entry->link\">";
echo "<img src=\"$entry->thumbnail\" width=\"160\" height=\"120\" border=\"0\" class=\"thumbnail\">";
echo "</a>";
echo "</td><td valign=\"top\">";
echo "Datum : $date";
echo "<br>";
echo "Door : ". $entry->author;
echo "<br>";
echo "Bekeken : ". $entry->statistics[viewCount];
echo "<br>";
echo "Lengte : ". $entry->enclosure[duration];
echo "<br>";
echo "Omschrijving<br>";
echo substr($entry->description,0,100); // sets length of description
echo "</td>";
echo "</tr>";
echo "</table>";
}
?>
</body>
</html>
Code example 2

Code example 3 without SimpleXML for PHP 4
<?php


/**
* XMLToArray Generator Class
* @author : MA Razzaque Rupom <rupom_315@yahoo.com>, <rupom.bd@gmail.com>
* Moderator, phpResource (LINK1http://groups.yahoo.com/group/phpresource/LINK1)
* URL: LINK2http://www.rupom.infoLINK2
* @version : 1.0
* @date 06/05/2006
* Purpose : Creating Hierarchical Array from XML Data
* Released : Under GPL
*/

class XmlToArray
{

var $xml='';

/**
* Default Constructor
* @param $xml = xml data
* @return none
*/

function XmlToArray($xml)
{
$this->xml = $xml;
}

/**
* _struct_to_array($values, &$i)
*
* This is adds the contents of the return xml into the array for easier processing.
* Recursive, Static
*
* @access private
* @param array $values this is the xml data in an array
* @param int $i this is the current location in the array
* @return Array
*/

function _struct_to_array($values, &$i)
{
$child = array();
if (isset($values[$i]['value'])) array_push($child, $values[$i]['value']);

while ($i++ < count($values)) {
switch ($values[$i]['type']) {
case 'cdata':
array_push($child, $values[$i]['value']);
break;

case 'complete':
$name = $values[$i]['tag'];
if(!empty($name)){
$child[$name]= ($values[$i]['value'])?($values[$i]['value']):'';
if(isset($values[$i]['attributes'])) {
$child[$name] = $values[$i]['attributes'];
}
}
break;

case 'open':
$name = $values[$i]['tag'];
$size = isset($child[$name]) ? sizeof($child[$name]) : 0;
$child[$name][$size] = $this->_struct_to_array($values, $i);
break;

case 'close':
return $child;
break;
}
}
return $child;
}//_struct_to_array

/**
* createArray($data)
*
* This is adds the contents of the return xml into the array for easier processing.
*
* @access public
* @param string $data this is the string of the xml data
* @return Array
*/
function createArray()
{
$xml = $this->xml;
$values = array();
$index = array();
$array = array();
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parse_into_struct($parser, $xml, $values, $index);
xml_parser_free($parser);
$i = 0;
$name = $values[$i]['tag'];
$array[$name] = isset($values[$i]['attributes']) ? $values[$i]['attributes'] : '';
$array[$name] = $this->_struct_to_array($values, $i);
return $array;
}//createArray


}//XmlToArray
$feedURL = file_get_contents('http://www.zideo.nl/gadgets/api/api.php?channel=6d596556&limit=10');
$xmlObj=new XmlToArray($feedURL);
$sxml = $xmlObj->createArray();
$feed=$sxml[feed];
foreach ($feed["entry"] as $entry)
{

$date= date("d-m-y", strtotime($entry->pubDate));
echo "<div class=\"title\"><a href=\"$entry->link\">" . $entry["media:group"][0]["media:title"]. "</a></div>";
echo "<table width=\"100%\"><tr><td>";
echo "<tr>";
echo "<td valign=\"top\" width=\"160\">";
echo "<a href=\"". $entry["link"] . "\">";
echo "<img src=\"" . $entry["media:group"][0]["media:thumbnail"] . "\" width=\"160\" height=\"120\" border=\"0\" class=\"thumbnail\">";
echo "</a>";
echo "</td><td valign=\"top\">";
echo "Datum : $date";
echo "<br>";
echo "Door : ". $entry["media:group"][0]["media:credit"];
echo "<br>";
echo "Bekeken : ". $entry["statistics"]["viewCount"];
echo "<br>";
echo "Lengte : ". $entry["enclosure"]["duration"];
echo "<br>";
echo "Omschrijving<br>";
echo substr($entry["description"],0,100); // sets length of description
echo "</td>";
echo "</tr>";
echo "</table>";
}
?>