Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

Getting Content by RSS Feed, Explained??

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
SpaceshipSpaceship
Watch
Impact
356
Hi,

Please could somebody Explain to me how i get Content onto my website using a RSS Feed, i have tried searching the internet for a decent tutorial but always ended confused.
Its 1st time i've ever looked into RSS feeds and im confused, any advice would be great.

I found the Feed i wanted, followed the Link and it gives me a page of Code :

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <rss version="2.0">
- <channel>
<title>SkySports.com - Premiership</title>
<link>http://home.skysports.com</link>
<copyright>Copyright(C) 2006 BSkyB</copyright>
<language>en-gb</language>
- <description>
- <![CDATA[ Premiership
]]>
</description>
<ttl>10</ttl>
<lastBuildDate>Mon, 7 Aug 2006 20:40:13 GMT</lastBuildDate>
- <item>
<pubDate>Mon, 7 Aug 2006 19:06:00 GMT</pubDate>
<title>Wenger seeks Cole resolution</title>
- <description>
- <![CDATA[ Arsenal boss Arsene Wenger wants Ashley Cole's future resolved within a week.
]]>
- <![CDATA[ <p></p>
]]>
- <![CDATA[ <a href="http://adserver.adtech.de/?adlink|500|1074815|0|1|AdId=1152476;BnId=1;itime=981252290;key=


and so it continues.

I read Online that i may Need a RSS to Html Converor (or something similar) To give me the Html to enter onto the place i want Feeds.

Im Lost, Please send advice or Tutorial Link Please!!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
•••
I tried searching for Html Rss Parser and got plenty of results, though i still cant work it!
I tried a few of the results, downloaded programs i was told too - but im still not sure.

I hope that it will suddenly just click! Im sure im missing something simple and not understanding it correctly but i just dont know what im doing.

Maybe RSS Feeds just arent for me.

Thanks Anyway for advice, i will plug away and see if i can work it out
 
0
•••
JSX2 is my favorite one.
 
0
•••
Cheers, i'll give that a look
 
0
•••
Okay friend wrong window wrong post the previous one. Sorry about that.

Here is the code that I use normally.

PHP:
<?php
set_time_limit(0);
//Enter the URL of RSS feed in the line below
$file = "http://theurlofrsshere";
$rss_channel = array();
$currently_writing = "";
$main = "";
$item_counter = 0;
function startElement($parser, $name, $attrs) {
   	global $rss_channel, $currently_writing, $main;
   	switch($name) {
   		case "RSS":
   		case "RDF:RDF":
   		case "ITEMS":
   			$currently_writing = "";
   			break;
   		case "CHANNEL":
   			$main = "CHANNEL";
   			break;
   		case "IMAGE":
   			$main = "IMAGE";
   			$rss_channel["IMAGE"] = array();
   			break;
   		case "ITEM":
   			$main = "ITEMS";
   			break;
   		default:
   			$currently_writing = $name;
   			break;
   	}
}
function endElement($parser, $name) {
   	global $rss_channel, $currently_writing, $item_counter;
   	$currently_writing = "";
   	if ($name == "ITEM") {
   		$item_counter++;
   	}
}

function characterData($parser, $data) {
	global $rss_channel, $currently_writing, $main, $item_counter;
	if ($currently_writing != "") {
		switch($main) {
			case "CHANNEL":
				if (isset($rss_channel[$currently_writing])) {
					$rss_channel[$currently_writing] .= $data;
				} else {
					$rss_channel[$currently_writing] = $data;
				}
				break;
			case "IMAGE":
				if (isset($rss_channel[$main][$currently_writing])) {
					$rss_channel[$main][$currently_writing] .= $data;
				} else {
					$rss_channel[$main][$currently_writing] = $data;
				}
				break;
			case "ITEMS":
				if (isset($rss_channel[$main][$item_counter][$currently_writing])) {
					$rss_channel[$main][$item_counter][$currently_writing] .= $data;
				} else {
					$rss_channel[$main][$item_counter][$currently_writing] = $data;
				}
				break;
		}
	}
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
	die("could not open XML input");
}

while ($data = fread($fp, 4096)) {
	if (!xml_parse($xml_parser, $data, feof($fp))) {
		die(sprintf("XML error: %s at line %d",
					xml_error_string(xml_get_error_code($xml_parser)),
					xml_get_current_line_number($xml_parser)));
	}
}
xml_parser_free($xml_parser);

// output HTML

if (isset($rss_channel["ITEMS"]))
{
echo "<font face='Verdana' size='2' color='#333333'>";
if (count($rss_channel["ITEMS"]) > 0)
{
for($i = 0;$i < count($rss_channel["ITEMS"]);$i++)
{
if (isset($rss_channel["ITEMS"][$i]["LINK"]))
{
echo "<a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a><br>";
}
else
{
echo $rss_channel["ITEMS"][$i]["TITLE"];
}
echo $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "<p> </p>";
}
}
else
{
echo "<b>There are no articles in this feed.</b>";
}
echo "</font>";
}
?>

Disclaimer: The above code is not mine. And I am not even claiming to have invented the code. Its derived from some free open source system. But I am a n00b and have forgot the scripts name. :(

Thanks.

If you want to use caching of the RSS feeds then let me know I have written another code this time myself for it. :D
 
0
•••
lol nick_mayhem I recognize that piece of code but I forgot the name of it too :D thanks though because it works and it's not too complicated, I found it once but deleted it thinking i found something better, only to be left empty-handed
 
0
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back