PDA

View Full Version : Habbo RSS News Feed



James!
09-02-2006, 09:30 PM
<?php
/*

*/
//url to rss feed of habbo site
$site = "http://www.habbohotel.com/habbo/en/community/newsletter/rss";

//dont edit anything below this line!
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
$tag = $name;
} elseif ($name == "ITEM") {
$insideitem = true;
}
}
function endElement($parser, $name) {
global $insideitem, $tag, $title, $description, $link;
if ($name == "ITEM") {
//echo's the content
printf("<dt><b><a href='%s'>%s</a></b></dt>",
trim($link),trim($title));
printf("<dd>%s</dd>",trim($description));
$title = "";
$description = "";
$link = "";
$insideitem = false;
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
switch ($tag) {
case "TITLE":
$title .= $data;
break;
case "DESCRIPTION":
$description .= $data;
break;
case "LINK":
$link .= $data;
break;
}
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("$site","r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
?>

Here is an example:

www.jmiller.be/habbo/rss.php

James!
09-02-2006, 09:36 PM
//url to rss feed of habbo site
$site = "http://www.habbohotel.con/habbo/en/community/newsletter/rss";

Change that to:

//url to rss feed of habbo site
$site = "http://www.habbohotel.co.uk/habbo/en/community/newsletter/rss";

For UK news.

Dan Williamson
09-02-2006, 09:40 PM
Hey,

It is actually really simple to do this, there is a tutorial on P2L and I think you followed a tutorial. Anyway why would people want a Habbo Hotel RSS feed?

Everyone thinks RSS is so difficult but it stands for something like 'Real Simple Syndication' or something i'm not sure, so feel free to correct me :)

Anyway I suppose this will be helpful to the newcomers who want Habbo Hotel Feeds on their Habbo Fansite.

- Dan

James!
09-02-2006, 09:57 PM
I found a thread on this on HF.

Thought it was useful..

This would be great to people who dont want news reporters, they can just clean up the font and layout, and put it in an iFrame.

dani342us
09-02-2006, 10:28 PM
I saw this in a nother habbo forum. Are you sure its yours. Lol

Tomm
22-02-2006, 08:47 PM
He ripped it from Habbo Forum ''/

Want to hide these adverts? Register an account for free!