/** * Send header and the generated feed on the standard output. * * @param string $title * the feed title * @param string $description * optional, a feed description * @param string $url * the url where the feed is published */ public function outputFeed($title, $description, $url) { $parser = $this->parserFactory->createFromWebPage(); $feed = new RSSFeedGenerator($title, $description, $this->parserFactory->getAlboPretorioLandingPage(), $url); foreach ($parser as $e) { $item = $this->converter->getRSSItem($e); if (strlen($item->errors)) { $feed->addComment($item->errors); } else { $feed->addItemObject($item); } } // output header('Content-type: application/rss+xml; charset=UTF-8'); /* * Impostazioni locali in italiano, utilizzato per la stampa di data e ora * (il server deve avere il locale italiano installato */ setlocale(LC_TIME, 'it_IT'); AccessLogUtils::logAccess(); echo $feed->getFeed(); }
* You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require "AlboComuneCTParser.php"; require "../RSS/RSSFeedGenerator.php"; require "../RSS/RSSFeedItem.php"; require "../phpalbogenerator/AccessLogUtils.php"; define("RSSPATH", "http://dev.opendatasicilia.it/albopop/catania/"); AccessLogUtils::logAccess(); $parser = AlboComuneCTParser::createByYear(); $feed = new RSSFeedGenerator("Albo del Comune di Catania", "Versione POP e social dell'Albo Pretorio del Comune di Catania", "http://www.comune.catania.gov.it/EtnaInWeb/AlboPretorio.nsf/HomePage?Open&buffer=A20110301121017437GH", RSSPATH . "alboct2RSS-social.php"); foreach ($parser as $r) { //remove the sender if it is internal to the municipality of Catania $title = preg_replace('%^.*- COMUNE DI CATANIA *%', '', $r->mittente_descrizione, 1); if (empty($title)) { $feed->addItem('ERROR', null, null, $r->link, $r->link); } else { $description = $r->repertorio . " - " . $r->tipo . ": " . $r->mittente_descrizione; $newpagelink = RSSPATH . 'sharer.php?anno=' . urlencode($r->anno) . "&numero=" . urlencode($r->numero); $feed->addItem($title, $description, null, $newpagelink, $newpagelink); } } //output header('Content-type: application/rss+xml; charset=UTF-8'); /* * Impostazioni locali in italiano, utilizzato per la stampa di data e ora * (il server deve avere il locale italiano installato */ setlocale(LC_TIME, 'it_IT'); echo $feed->getFeed();