upcycle
##stmadeveloper RSS modual - delicious RSS Code for XSITE
##PRO BlackHat
##Development
## This modual and other Stmadeveloper.com RSS moduals should be ##used with care.
## You do not have the right to share this code with others. You may ##use it for ##your own use only.
error_reporting(0);
function startElement($parser, $tagName, $attrs) {
global $insideitem, $tag;
if ($insideitem) {
$tag = $tagName;
} elseif (($tagName == "ITEM") || ($tagName == "IMAGE")) {
$insideitem = true;
}
}
function endElement($parser, $tagName) {
global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n;
if ($i >= $n) {
return;
}
if ($tagName == "ITEM") {
printf("");
printf("\n");
printf("\n");
printf(" \n");
printf(" ");
$title = "";
$description = "";
$link = "";
$iurl = "";
$insideitem = false;
$i += 1;
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link, $iurl;
if ($insideitem) {
switch ($tag) {
case "TITLE":
$title .= $data;
break;
case "DESCRIPTION":
$description .= $data;
break;
case "LINK":
$link .= $data;
break;
case "URL":
$iurl .= $data;
break;
}
}
}
function parse_feed ($url, $num) {
global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n;
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
$iurl = "";
$i = 0;
$n = $num;
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen($url,"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);
$i = 0;
}
$rssfeedurl = 'http://del.icio.us/rss/tag/upcycle';
$rssfeedurl = str_replace("-", "%20", "$rssfeedurl");
parse_feed ("$rssfeedurl",4);
?>
|