| 1 | <?php |
| 2 | $url = 'http://www.ssps.cz/pages/rozvrhy/index.php'; |
| 3 | $croom = '3.I'; |
| 4 | $croom = trim($_GET['q']); |
| 5 | |
| 6 | function rss_add_item($title, $link='', $desc='') { |
| 7 | echo("\n<item>\n"); |
| 8 | echo("\t<title>$title</title>\n"); |
| 9 | echo("\t<link>$link</link>\n"); |
| 10 | echo("\t<description>$desc</description>\n"); |
| 11 | echo("</item>\n\n"); |
| 12 | } |
| 13 | ?> |
| 14 | <?php echo('<?xml'); ?> version="1.0" encoding="UTF-8"?><rss version="0.91"><channel> |
| 15 | |
| 16 | <title>Zmeny v rozvrhu SSPS</title> |
| 17 | <link><?php echo($url); ?></link> |
| 18 | <description>Aktualni zmeny v rozvrhu SSPS</description> |
| 19 | <language>cs</language> |
| 20 | |
| 21 | <?php |
| 22 | $croom = str_replace('.', '\.', $croom); |
| 23 | $feed = spliti('<.?..>', iconv('WINDOWS-1250', 'UTF-8', file_get_contents($url))); |
| 24 | |
| 25 | foreach($feed as $line) { |
| 26 | $line = trim($line); |
| 27 | if($line == '' || eregi('rozvrhy', $line)) continue; |
| 28 | if(eregi($croom, $line)) rss_add_item($line, $url); |
| 29 | } |
| 30 | |
| 31 | ?> |
| 32 | |
| 33 | </channel></rss> |