Wixi Services
Feeds >> PHP Integration ExamplePHP Integration example
This example shows you how to query the Wixi feeds from your website and include their output on your pages. It will show the 5 latest public media files added on Wixi.
It is written in PHP programmation language, but could easily be ported to any other language.
Requirements: PHP5 webserver with XML extension enabled
Source Code
<?php
/*
WIXI Source Code (29.02.2008)
This example shows you how to retrieve the output of Wixi feeds and include them on your pages
*/
// Initialize variables
$cnt = 0;
$wixi_feed_url = "http://wixi.com/rss2/rss2.php";
echo '<h1>Latest files added on <a href="http://www.wixi.com" target="_blank">Wixi</a>';
// Retrieve the feed content
$feed_content = file_get_contents($wixi_feed_url);
// Load the XML feed
$xml = simplexml_load_string(utf8_encode($feed_content));
// Parse the XML feed
foreach($xml->item as $item)
{
$title = $item->title;
$link = $item->link;
// Display the output
echo '<a href="'.$link.'" target="_blank">'.$title.'</a><br />';
// Limit to 5 results
if ($cnt > 4)
break;
}
?>
/*
WIXI Source Code (29.02.2008)
This example shows you how to retrieve the output of Wixi feeds and include them on your pages
*/
// Initialize variables
$cnt = 0;
$wixi_feed_url = "http://wixi.com/rss2/rss2.php";
echo '<h1>Latest files added on <a href="http://www.wixi.com" target="_blank">Wixi</a>';
// Retrieve the feed content
$feed_content = file_get_contents($wixi_feed_url);
// Load the XML feed
$xml = simplexml_load_string(utf8_encode($feed_content));
// Parse the XML feed
foreach($xml->item as $item)
{
$title = $item->title;
$link = $item->link;
// Display the output
echo '<a href="'.$link.'" target="_blank">'.$title.'</a><br />';
// Limit to 5 results
if ($cnt > 4)
break;
}
?>
Download Source Code
Download here the source code (rename the .phps file to .php)