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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
| <?php
//comment de zenders uit die niet weergegeven moeten worden
global $to_display;
$to_display = array (
"Nederland 1",
"Nederland 2",
"Nederland 3",
"RTL 4",
"RTL 5",
"Net 5",
"SBS 6",
//"Nickelodeon",
"Yorin",
"V8",
//"BVN",
"VRT TV1",
"KETNET/Canvas",
//"VTM",
//"Kanaal 2",
//"VT4",
"BBC 1",
"BBC 2",
//"BBC World",
//"ARD",
//"ZDF",
//"NRD Fernsehen",
//"Sudwest Fernsehen",
//"WDR Fernsehen",
//"3Sat",
//"Sat 1",
//"RTL",
//"PRO 7",
//"RTBF La 1",
//"RTBF La 2",
//"TV 5",
//"Rai Uno",
//"TRT int.",
//"AT 5",
//"Canal+ Rood",
//"Canal+ Blauw",
//"TMF",
//"MTV",
//"Mezzo",
//"CNN",
//"Discovery Channel",
"Eurosport",
//"National Geographic",
//"TCM",
//"Animal Planet"
);
$filename = "http://www.tvgids.nl/nustraks.php?alle=TRUE";
$handle = fopen($filename ,"r");
$contents = "";
while(!feof($handle)) $contents .= fgets($handle, 4096);
fclose ($handle);
$pos1 = strpos($contents, "Klik op de titel voor details");
$pos2 = strpos($contents, "Nederlandstalige zenders", $pos1);
$data = substr($contents, $pos1, $pos2-$pos1);
$pos1 = strpos($data, "<tr");
$data = substr($data, $pos1);
printf("<html><head><title>TV gids</title><link rel=\"stylesheet\" href=\"style.css\">");
printf("<style>body { scrollcar-face-color: #243462; scrollbar-shadow-color: #243462; scrollbar-highlight-color: #243462; scrollbar-3dlight-color: #243462; scrollbar-darkshadow-color: #243462; scrollbar-track-color: #243462; scrollbar-arrow-color: #ffffff } </style>");
printf("<meta http-equiv=\"refresh\" content=\"600\">");
printf("</HEAD>");
printf("<BODY BGCOLOR=\"#243462\"><b>Nu & straks op tv:</b><br><br>");
printf("<TABLE border=\"0\">");
while (true)
{
$offset = printNext($data);
if( $offset == 0 ) break;
$data = substr($data, $offset);
}
printf("</TABLE>");
printf("</BODY></HTML>");
function printNext($data)
{
global $to_display;
$pos = strpos($data, "</tr>");
if ($pos<1) return 0;
$offset = $pos+5;
$chunk = substr($data, 0, $pos);
//$zender
$pos0 = strpos($chunk, "href");
$pos1 = strpos($chunk, ">", $pos0);
$pos2 = strpos($chunk, "</a>", $pos1);
$zender = substr($chunk, $pos1+1, $pos2-$pos1-1);
//Als de zender niet hoeft, gaan we niet verder parsen
if (in_array($zender, $to_display))
{
$pos3 = strpos($chunk, "</td>", $pos2);
$chunk = substr($chunk, $pos3+5);
//$tijd1
$pos0 = strpos($chunk, "<strong>");
$pos1 = strpos($chunk, "<!--", $pos0);
$tijd1 = substr($chunk, $pos0+8, $pos1-$pos0-8);
if (strlen($tijd1) == 0) $tijd1 = "**:**";
$pos3 = strpos($chunk, "</td>", $pos1);
$chunk = substr($chunk, $pos3+5);
//naam1
$pos0 = strpos($chunk, "details_programma");
$pos2 = strpos($chunk, "</td>");
if ($pos0 < $pos2) {
$pos1 = strpos($chunk, "</a>", $pos0);
$naam1 = substr($chunk, $pos0+19, $pos1-$pos0-19);
} else {
$naam1 = "Geen uitzending";
}
$pos3 = strpos($chunk, "</td>", $pos1);
$chunk = substr($chunk, $pos3+5);
//tijd2
$pos0 = strpos($chunk, "<strong>");
$pos1 = strpos($chunk, "<!--", $pos0);
$tijd2 = substr($chunk, $pos0+8, $pos1-$pos0-8);
if (strlen($tijd2) == 0) $tijd2 = "**:**";
$pos3 = strpos($chunk, "</td>", $pos1);
$chunk = substr($chunk, $pos3+5);
//naam2
$pos0 = strpos($chunk, "details_programma");
$pos2 = strpos($chunk, "</td>");
if ($pos0 < $pos2) {
$pos1 = strpos($chunk, "</a>", $pos0);
$naam2 = substr($chunk, $pos0+19, $pos1-$pos0-19);
} else {
$naam2 = "Geen uitzending";
}
//printen
printf("<TR><TD><B>" . $zender . "</B> </TD><TD>" . $tijd1 . "</TD><TD>" . $naam1 . " </TD><TD>" . $tijd2 . "</TD><TD>" . $naam2 . "</TD></TR>");
}
return $offset;
}
?> |