Hi all im in need of some help

Im using this code I found on the net, its a simple RSS parser. What I would like to do is have this appear at the top of my page and then call it from different sections of the page, also I would like to call Rss feeds from different sites around the net.

I guess I need to send something to this line each time:

$fp = fopen("http://www.sitepoint.com/rss.php","r")

Does anyone know how to manipulate this code so that it can do that, thanks 🙂

<?php

$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") {
		printf("<dt><b><a href='%s'>%s</a></b></dt>",
			trim($link),htmlspecialchars(trim($title)));
		printf("<dd>%s</dd>",htmlspecialchars(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("http://www.sitepoint.com/rss.php","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);

?>
    Write a Reply...