tag if(strcasecmp($name, "feed") == 0) { // compare the feed.id attribute if(isset($_GET['id']) && !empty($_GET['id']) && $_GET['id'] == $attrs['ID']) { // found the correct ID // get the data at the associated URL if (!($fpURL = fopen($attrs['URL'], "r"))) { die("could not open URL"); } // get the data from this URL while (!feof($fpURL)) { $strOutData .= fread($fpURL, 8192); } fclose($fpURL); } } } // function is hit for each closing tag encountered function endTag($parser, $name) { } // begin main execution // get path to LiveFeeds.xml and open it $arrPathInfo = pathinfo($_SERVER['SCRIPT_FILENAME']); $strXMLFile = $arrPathInfo['dirname']."/LiveFeeds.xml"; if (!($fp = fopen($strXMLFile, "r"))) { die("could not open Adobe feeds"); } // do they want a particular feed if(isset($_GET['id']) && !empty($_GET['id'])) { // get a specific RSS feed $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startTag", "endTag"); while (($data = fread($fp, 8192)) && empty($strOutData)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf("XML error: %s at line %d, byte %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser), xml_get_current_byte_index($xml_parser))); } } xml_parser_free($xml_parser); } // either feed wasn't found or they want the list of feeds if(empty($strOutData)) { // get the original XML file fseek($fp, 0); // go back to the beginning in case we already read while ($data = fread($fp, 8192)) { $strOutData .= $data; } } fclose($fp); header('Content-type: text/xml'); echo $strOutData; ?>