Follow us on Twitter!
Society leans ever heavily on computers, if you have the power to take out computers you can take out society. - cubeman372
Saturday, April 19, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 28
Guests Online: 27
Members Online: 1

Registered Members: 82838
Newest Member: w1zarrd
Latest Articles

RSS Tutorial

Arrow Image Simple/easy RSS tutorial



Hi people, its my first article here...
About RSS

In recent time the web 2.0 has widely spread over most of the web sites

For more information about Web2.0

Web 2.0

RSS Tutorial:

--Before you read this article, you should have a basic understanding of :

- XHTML
- XML


Some tips:
> RSS stands for Really Simple Syndication
> RSS defines an easy way to share the news of the website e.g
http://hellboundh. . .ws/rss.xml

> RSS is written in XML.
> RSS Files can be easily updated.
> RSS file must have an .xml extension.
> RSS data is simple and doesn't cost much bandwidth :P
1.RSS intro:

RSS was designed to veiw contents, if youve a website, a news section in that website, (if you have no RSS feed in it) visitors will have to visit it daily to see what has been updated...

There are several versions of RSS

Heres the history of the RSS taken from http://w3schools.. . .istory.asp


* 1997 - Dave Winer develops scripting News. RSS was born.

* 1999 - Netscape develops RSS 0.90 (which supported scriptingNews). This was simply XML with an RDF Header.

* 1999 - Dave Winer at UserLand develops scriptingNews 2.0b1 (This included Netscape's RSS 0.90 features)

* 1999 - Netscape develops RSS 0.91. In this version they removed the RDF header, but included most features from scriptingNews 2.0b1.

* 1999 - UserLand gets rid of scriptingNews and uses only RSS 0.91

* Netscape stops their RSS development

* 2000 - UserLand releases the official RSS 0.91 specification

* 2000 - A group lead by Rael Dornfest at O'Reilly develops RSS 1.0. This format uses RDF and namespaces. This version is often confused as being a new version of 0.91, but this is a completely new format with no ties to RSS 0.91

* 2000 - Dave Winer at UserLand develops RSS 0.92

* 2002 - Dave Winer develops RSS 2.0 after leaving Userland

* 2003 - The official RSS 2.0 specification is released




Actually, theres no standard version, many sites use RSS 0.91, 1.0, 0.9x


2.RSS Syntax:

This is a simple RSS document:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">

<channel>
<title>HBH</title>
<link>http://hellboundhackers.com/</link>
<description>Learn to secure your website...</description>
<item>
<title>HBH con</title>
<link>http://hellboundhackers.com/hbhcon.php</link>
<description>Come on and buy tickets !</description>
</item>
<item>
<title>New SQL injection</title>
<link>http://hellboundhackers.com/news/link_to_the_news_page</link>
<description>New SQL Injection discovered, its extreeemly dangrous</description>
</item>
</channel>

</rss>


--first line of the document is the XML version declaration.
--Second line defines the RSS version (here we've used version "2.0")
--XML tag has no end tag...e.g (<?xml version="1.0" encoding="ISO-8859-1" ?></xml> <<Wrong)
(<?xml version="1.0" encoding="ISO-8859-1" ?> <<Right)
Next line contains the <channel> element.
This element is used to describe the RSS feed.

3.Elements Description :

<channel> element contains one or more of <items> (like the flat which has some rooms)

Element Description

<category> Optional. Defines one or more categories for the feed

<cloud> Optional. Register processes to be notified immediately of updates of the feed

<copyright> Optional. Notifies about copyrighted material

<description> Required. Describes the channel

<docs> Optional. Specifies an URL to the documentation of the format used in the feed

<generator> Optional. Specifies the program used to generate the feed

<image> Optional. Allows an image to be displayed when aggregators present a feed

<language> Optional. Specifies the language the feed is written in

<lastBuildDate> Optional. Defines the last-modified date of the content of the feed

<link> Required. Defines the hyperlink to the channel

<managingEditor> Optional. Defines the e-mail address to the editor of the content of the feed

<pubDate> Optional. Defines the last publication date for the content of the feed

<rating> Optional. The PICS rating of the feed

<skipDays> Optional. Specifies the days where aggregators should skip updating the feed

<skipHours> Optional. Specifies the hours where aggregators should skip updating the feed

<textInput> Optional. Specifies a text input field that should be displayed with the feed

<title> Required. Defines the title of the channel

<ttl> Optional. Specifies the number of minutes the feed can stay cached before refreshing it from the source

<webMaster> Optional. Defines the e-mail address to the webmaster of the feed

RSS <item> Element


Element Description

<author> Optional. Specifies the e-mail address to the author of the item

<category> Optional. Defines one or more categories the item belongs to

<comments> Optional. Allows an item to link to comments about that item

<description> Required. Describes the item

<enclosure> Optional. Allows a media file to be included with the item

<guid> Optional. Defines a unique identifier for the item

<link> Required. Defines the hyperlink to the item

<pubDate> Optional. Defines the last-publication date for the item

<source> Optional. Specifies a third-party source for the item

<title> Required. Defines the title of the item

<item>:
Each <item> considered a pack that contains some news...

It contains child elements which are:




<title>, <item>, <link> and <describtion> are the basics

>><title> : is the title for the news (e.g) "HBH Con"

>><link> : is the link to the item, like : http://hellboundhackers.org/hbhcon.php

>><description> : Describes what the <item> tells, considered the news (story)


4.RSS Readers:

Note: Firefox has a built-in rss reader, for example if youre in a website offers RSS feeds, you will see an RSS icon beside teh URL

You can write your own RSS feed reader with different ways (PHP (preg_match), Javascript(getElementByTagName), or AJAX)

Simple RSS Reader with PHP(preg_match):



<?php

function display_feed($url, $num=5, $template=
"<div id=\"feeditem\"><a href=\"#link#\">
#title#</a><br />#description#</div>")
{

if ($rss=@file_get_contents($url)){
$rss=xml2array($rss);
if (is_array($rss)){
$code="";
$count=0;
foreach($rss['rss'][0]['channel'][0]['item'] as $val){
$tpl=$template;
foreach($val as $key=>$val2)
{
$val2=html_entity_decode(htmlentities(strip_tags($val2)));
$tpl=str_replace("#".strtolower($key)."#", $val2, $tpl);

}

if ($count<$num) $code.=$tpl;
++$count;
}
}else{
return FALSE;
}
echo $code;
return TRUE;
}else{
return FALSE;
}
}
function xml2array($text)
{

$reg_exp = '/<(\w+)[^>]*>(.*?)<\/\\1>/s';
preg_match_all($reg_exp, $text, $match);
foreach ($match[1] as $key=>$val)
{
if (preg_match($reg_exp, $match[2][$key]) )

{

$array[$val][] = xml2array($match[2][$key]);

}
else
{

$array[$val] = $match[2][$key];

}

}
return $array;

}


display_feed("http://www.hellboundhackers.org/news/rss.xml", 10);

?>




That was a simple RSS Reader (by PHP) for Hellboundhackers.org, simpily, it grabs each tag(<item>, <title>, <link> and<description>)
and echo them out...

For AJAX:

Actually, AJAX is a big field that deserves a separated article :-).
But, this is a very good AJAX RSS reader (dragable boxes)
http://www.dhtmlgoodies.com/index.html?whichScript=dragable-boxes
** You can find more and more scripts for AJAX here :
http://www.dhtmlgoodies.com/index.html?page=ajax **

5.RSS References:

a) Thanks for W3Schools.com my reference for ever :p
b) php.net PHP for ever!!
c) wikipedia.org....hmmm? everything you needed over there...

Comments

richohealeyon July 09 2007 - 11:00:54
WHOA... like.. whoa... this is awesome, i suggested that you expand a little, this is fantasic. Next time someone asks about RSS i'm definately linking them here.
midoon July 09 2007 - 11:08:33
WOOHOO, Thanks richo for Appreciation Grin
x-xon July 09 2007 - 11:58:06
great articleGrin
mitz247on July 09 2007 - 12:03:32
10/10, quality!
midoon July 09 2007 - 12:19:01
Thanks guys for reading and rating Smile Hope the article was useful...
mozzeron July 09 2007 - 19:24:02
FUCKING CITE FUCKING YOUR FUCKING FUCKING FUCKING SOURCES FUCKING YOU FUCKING FUCKING FUCKING etc... http://php.digipe. . .ef.xml.php
system_meltdownon July 09 2007 - 22:45:32
Wow, you basically just done "Other 13" for everyone, good work
mastergameron July 09 2007 - 23:27:54
--XML tag has no end tag... Actually it does, the ?> on the end is the closing tag (same as in PHP)
midoon July 09 2007 - 23:33:28
@mastergamer: hmmm, i meant that its not like <rss..>which has another </rss>
spywareon July 10 2007 - 00:26:55
Worst RSS & XML editor ever. I see no mention about the use of XML in other applications and the fact that the programming language itself is useless without interpreter. Basically you just copied some information off the web and pasted it all in one document. Maybe you can get away with this style of work at your school but I don't like it at all. Rating "avarage" for an avarage article.
spywareon July 10 2007 - 00:27:22
*editor = article. Don't ask, my mind is messed up.
midoon July 15 2007 - 21:30:49
Thanks all...
Apollo_15on February 13 2008 - 17:03:17
great article Wink
Post Comment

Sorry.

You must have completed the challenge Basic 1 and have 100 points or more, to be able to post.