I am currently trying to create a widget using XML and PHP however it works fine at home however it does not on other servers.
Here is a link to the widget - http://www.cems.uwe....idget/index.php
Here is what I have tried so far :
index.php
<!Doctype>
<!-- The aim of this document is to build a structure which makes use of three tabs which stores and retrieves rss feeds from 3 external files maing use of php to retrieve the rss feeds and then using xml to retrieve certain items within these xml files, inthis case the title, description and publication date. -->
<html>
<head>
<title></title>
<!-- Including javascript file to improve interactivity and to allow content to be displayed without having to be navigated to another page. -->
<link rel="stylesheet" href="css/default.css" />
<script src="js/jquery-1.2.6.pack.js" type="text/javascript"></script>
<script src="js/myScript.js" type="text/javascript"></script>
</head>
<body>
<!-- Include external php file building the functions necessary for retrieveing and building upon the rss feeds -->
<?php include("includes/functions.php"); ?>
<div id="wrap">
<ul id="nav">
<li><a href="#content_1" class="selected">Metalground</a></li>
<li><a href="#content_2">Metalhammer</a></li>
<li><a href="#content_3">MetalTalk</a></li>
</ul>
<div id="mainContent">
<div id="content_1"><!-- first tab --->
<?php getFeed("http://feeds.feedburner.com/metalunderground.xml");?>
</div><!--end content 1-->
<div id="content_2"><!-- second tab --->
<?php getFeed("http://feeds.feedburner.com/metalhammer/main"); ?>
</div><!--end content 2-->
<div id="content_3"><!-- third tab --->
<?php getFeed("http://metaltalk.net/rss.php"); ?>
</div><!--end content 3-->
</div><!--end main content -->
</div><!--end wrap-->
</body>
</html>
functions.php
<?php
// the function getFeed is used to retrieve the feed url created by the feed_url variable.
function getFeed($feed_url) {
$content = file_get_contents($feed_url);
//the content variable is created to get the contents of the file. For example, it will read and retrieve the content contained within certain unique tags.
$x = new SimplexmlElement($content);
//the SimpleXMLElement represents an element
echo "<ul>";
// for every entry that is found use xml to create unique tags which retrieves the title, description and publication of the entry.
//an example of using xml is that you can create your own tags, are not restricted to particular vocabularies and you can style your tags to your own satisfaction.
foreach($x->channel->item as $entry) {
echo "
<entry>
<li>
<heading>" . $entry->title . "</heading>
<description><p> ". $entry->description . "</p></description>
<date><p> ". $entry->pubDate . "</p></date>
</li>
</entry>";
}
echo "</ul>";
}
?>
*note - the error i am getting is - "Warning: file_get_contents(http://feeds.feedburner.com/metalunderground.xml) [function.file-get-contents]: failed to open stream: Network is unreachable in includes/functions.php on line 4"

New Topic/Question
Reply



MultiQuote




|