rss-tvgids
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?
header("Content-Type: application/xml; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
$dagen = array("Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag");
?>
<rss version="2.0">
<channel>
<title>TV Gids Feed</title>
<link>link</link>
<description>Starttijden van TV Uitzendingen.</description>
<language>nl-NL</language>
<copyright>Copyright naam</copyright>
<pubDate><? echo date("D, j M Y H:i:s", time()); ?> GMT</pubDate>
<lastBuildDate><? echo date("D, j M Y H:i:s", time()); ?> GMT</lastBuildDate>
<category>TV Programma's</category>
<managingEditor>naam</managingEditor>
<webMaster>naam</webMaster>
<image><url>images/ico.gif</url><title>naam</title><link>../</link></image>
<?
if(isset($_GET['zenders']) && isset($_GET['programmas'])) {
$zenders = explode(",", strtolower($_GET['zenders']));
$programmas = explode(",", strtolower($_GET['programmas']));
if(count($zenders) == count($programmas) && count($programmas) <= 10 && count($programmas) > 0) {
for($i=0; $i < count($programmas); $i++) {
$results = @file("http://www.optv.nu/paginas/zoekprg.php?sn=".str_replace(" ", "+", $zenders[$i])."&zt=".str_replace(" ", "+", $programmas[$i]));
preg_match_all("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $results[94], $dates, PREG_SET_ORDER);
preg_match_all("/([0-9]{2}):([0-9]{1,2})/", $results[94], $times, PREG_SET_ORDER);
$dates = array_reverse($dates);
$times = array_reverse($times);
for($s=0; $s < count($dates); $s++) {
echo " <item>\n";
$dag = $dagen[date("w", strtotime($dates[$s][0]))];
$dagenVanNu = date("j", strtotime($dates[$s][0])) - date("j", time());
echo " <title>".ucwords($programmas[$i])." ".$dag."</title>\n";
echo " <category>".ucwords($programmas[$i])."</category>\n";
echo " <link>http://www.tvgids.nl/zoeken/?trefwoord=".$programmas[$i]."&station=&genre=&dagdeel=".$dagenVanNu.".0</link>\n";
if(file_exists("images/".$programmas[$i].".jpg")) {
echo " <description>".ucwords($programmas[$i])." begint op ".$dag." om ".$times[$s][0]." op de TV Zender ".$zenders[$i].".<br><br><img src="images/".$programmas[$i].".jpg" alt="".ucwords($programmas[$i])."" ></description>\n";
}else{
echo " <description>".ucwords($programmas[$i])." begint op ".$dag." om ".$times[$s][0]." op de TV Zender ".$zenders[$i].".</description>\n";
}
echo " <pubDate>".date("D, j M Y H:i:s", time()+(-$s*100)+$i)." GMT</pubDate>\n";
echo " </item>\n";
}
}
}else{
echo "Ongeldige Invoer!";
}
}else{
echo "Er ontbreken gegevens!";
}
?>
</channel>
</rss>
header("Content-Type: application/xml; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
$dagen = array("Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag");
?>
<rss version="2.0">
<channel>
<title>TV Gids Feed</title>
<link>link</link>
<description>Starttijden van TV Uitzendingen.</description>
<language>nl-NL</language>
<copyright>Copyright naam</copyright>
<pubDate><? echo date("D, j M Y H:i:s", time()); ?> GMT</pubDate>
<lastBuildDate><? echo date("D, j M Y H:i:s", time()); ?> GMT</lastBuildDate>
<category>TV Programma's</category>
<managingEditor>naam</managingEditor>
<webMaster>naam</webMaster>
<image><url>images/ico.gif</url><title>naam</title><link>../</link></image>
<?
if(isset($_GET['zenders']) && isset($_GET['programmas'])) {
$zenders = explode(",", strtolower($_GET['zenders']));
$programmas = explode(",", strtolower($_GET['programmas']));
if(count($zenders) == count($programmas) && count($programmas) <= 10 && count($programmas) > 0) {
for($i=0; $i < count($programmas); $i++) {
$results = @file("http://www.optv.nu/paginas/zoekprg.php?sn=".str_replace(" ", "+", $zenders[$i])."&zt=".str_replace(" ", "+", $programmas[$i]));
preg_match_all("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/", $results[94], $dates, PREG_SET_ORDER);
preg_match_all("/([0-9]{2}):([0-9]{1,2})/", $results[94], $times, PREG_SET_ORDER);
$dates = array_reverse($dates);
$times = array_reverse($times);
for($s=0; $s < count($dates); $s++) {
echo " <item>\n";
$dag = $dagen[date("w", strtotime($dates[$s][0]))];
$dagenVanNu = date("j", strtotime($dates[$s][0])) - date("j", time());
echo " <title>".ucwords($programmas[$i])." ".$dag."</title>\n";
echo " <category>".ucwords($programmas[$i])."</category>\n";
echo " <link>http://www.tvgids.nl/zoeken/?trefwoord=".$programmas[$i]."&station=&genre=&dagdeel=".$dagenVanNu.".0</link>\n";
if(file_exists("images/".$programmas[$i].".jpg")) {
echo " <description>".ucwords($programmas[$i])." begint op ".$dag." om ".$times[$s][0]." op de TV Zender ".$zenders[$i].".<br><br><img src="images/".$programmas[$i].".jpg" alt="".ucwords($programmas[$i])."" ></description>\n";
}else{
echo " <description>".ucwords($programmas[$i])." begint op ".$dag." om ".$times[$s][0]." op de TV Zender ".$zenders[$i].".</description>\n";
}
echo " <pubDate>".date("D, j M Y H:i:s", time()+(-$s*100)+$i)." GMT</pubDate>\n";
echo " </item>\n";
}
}
}else{
echo "Ongeldige Invoer!";
}
}else{
echo "Er ontbreken gegevens!";
}
?>
</channel>
</rss>