Thu Jan 10, 2013 2:00 am
<html>
<head>
<title>Parse RSS feeds, load RSS.xml files</title>
<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script type="text/javascript" src="./jFeed/build/dist/jquery.jfeed.pack.js"></script>
<script>
$(document).ready(function(){
$("button#btn1").click(function(){
loadRSS();
});
function loadRSS(){
$.getFeed({
// Note here we use php page and send the the URL to it as parameter.
url: 'getRSS.php?url=http://www.codemiles.com/rss.php',
success: function(feedObj) {
//Title and link
$('#RSSFeeds').append('<h1><a href="' + feedObj.link + '">' + feedObj.title + '</a>' + '</h1>');
//Print the list of feeds as read.
var contentRSS = '<ul>';
$(feedObj.items).each(function(){
var $singleFeed = $(this);
contentRSS += '<li>' +
'<h2><a href ="' + $singleFeed.attr("link") + '" >' + $singleFeed.attr("title") + '</a></h2> ' +
'<p>' + $singleFeed.attr("description") + '</p>' +
'<p>' + $singleFeed.attr("c:date") + '</p>' +
'</li>';
});
contentRSS += '</ul>';
$('#RSSFeeds').append(contentRSS);
}
});
}
});
</script>
</head>
<body>
<div id="RSSFeeds" ></div>
<button id="btn1">Load Feeds</button>
</body>
</html>
<?php
// Get URL parameter value
if (!isset($_REQUEST["url"])) exit;
$url = $_REQUEST["url"];
// make sure that HTTP part exists.
if (substr($url, -0, 7) != "http://") exit;
echo file_get_contents($url);
?>
http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.