Mam pewnien problem ze skryptem php ktory ponizej umiescilem, a mianowicie nie wyswietla mi zawartosci pliku xml z tego kanalu http://www.gofin.pl/rss/podatki.xml
Plik jest pobierany na serwer lecz nie jest on wyswietlany na stronie. Nie wiem czy tkwi problem prosze o pomoc.
Jesli ktos ma inny dobry skrypt ktory jest kompatybilny z tym kanalem rss i wyswietla go na stronie to bardzo prosze o podanie jego nazwy lub umieszczenie na jakis serwer.
Tutaj znajduje sie skrypt z ktorym mam problem:
<?php /************************************************************ RSS Fetch 0.4.1 RSS Feed Reader Author: Drew Phillips www.neoprogrammers.com Copyright 2005 Drew Phillips This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ************************************************************/ class rss_parser { var $update_interval = 60; /* How often to fetch the rss file A cached version will be used between updates */ var $data_directory = "/home/neoprog/www/rss"; /* Where to store the rss data from the feeds Note: an absolute path is better than a relative path here unless you plan on keeping the script to display the feeds in the same folder as this file and the feeds. */ /* NO NEED TO EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING */ var $rss_url; var $num_to_show; var $do_update; var $content; var $feed_title; var $feed_link; var $feed_description; var $my_html; function rss_parser($url, $numtoshow = 10, $html = "", $update = 0) { $this->rss_url = $url; $this->num_to_show = $numtoshow; $this->do_update = $update; $this->content = $this->fetch_feed(); $this->parse_feed(); $this->show(); } /* string */ function fetch_feed() { $filename = $url_parts['host'] . str_replace("/", ",", $url_parts['path']) . "_" . @$url_parts['query']; $update = 1; } } else { $create= 1; } if($create == 1 || ($this->do_update == TRUE && $update == 1)) { if (!$fp) { return; } ."Host: " . $url_parts['host'] . "r\n" ."User-Agent: Drew's RSS Reader 0.1r\n" ."Connection: Closer\nr\n"); } if(!$output) { return $rss_data; } else { } } //update } /* void */ function parse_feed() { $this->feed_title = @$title[1]; $this->feed_link = @$link[1]; $this->feed_description = @$description[1]; } preg_match_all("/(?:<([w:]*)[^>]*>(?:<![CDATA[)?(.*?)(?:]]>)?</1>)+?/si", preg_replace("/<item[^>]*>/", "", $items[0][$i]), $elements); $elements[1][$j] = str_replace(":", "__", $elements[1][$j]); //regex fix for items with : like dc:date } } } /* void */ function show() { if($this->my_html == "") { $this->show_html(); } else { $this->show_user_html(); } } function show_html() { for($i = 0; $i < $show; ++$i) { echo "- <a href=\"{$this->rss[$i]['link']}\" target=\"_new\">{$this->rss[$i]['title']}</a><br />\n"; } } function show_user_html() { for($i = 0; $i < $show; ++$i) { } } } // end class ?>
<!-- To include this sample on your homepage, make sure the page's extension is .php and inside it put include "example.php"; just make sure example is in the same folder as your main page. --> <table style="background-color: #FFFFFF; border: solid 1px #000000;" cellpadding="2" cellspacing="1" width="70%" align="center"> <tr> <td style="background-color: #0096D2; font-weight: bold; color: #FFFFFF; font-size: 14px; text-align: center;" width="75%" align="center"> CNN News: Politics </td> </tr> <?php include_once "./rss_fetch.php"; $html = " <tr>\n"; $html .= " <td style='background-color: #DCF0FA; font-weight: bold; color: #000000; font-size: 13px;'>\n"; $html .= " <font size='+1'><a href='#{link}' target='_new'>#{title}</a></font><br />\n"; $html .= " #{description}<br />\n"; $html .= " <font size='2'>#{pubDate}<br /><br />\n"; $html .= " </td>\n"; $html .= " </tr>\n"; $rss = new rss_parser("http://rss.cnn.com/rss/cnn_allpolitics.rss", 5, $html, 1); ?> </table>