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
| <?php
/***
* Uitzendinggemist Uitzending info retriever
* (c) Gerdriaan Mulder, 2009
* Gebruik / aanpassen op eigen risico
*/
ini_set('user_agent', $_SERVER['HTTP_USER_AGENT']);
//header('Content-Type: text/html;charset=UTF-8;');
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8;" />';
function disguise_curl($url, $cookies)
{
$curl = curl_init();
// Setup headers - I used the same headers from Firefox version 2.0.0.6
// below was split up because php.net said the line was too long. :/
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: "; // browsers keep this blank.
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_COOKIE, $cookies);
curl_setopt($curl, CURLOPT_REFERER, 'http://www.uitzendinggemist.nl');
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$html = curl_exec($curl); // execute the curl command
curl_close($curl); // close the connection
return $html; // and finally, return $html
}
if (!isset($_GET['aflID']) && empty($_GET)) {
?>
<form method="get" action="./omroep.php">
<input type="text" name="aflID" />
<input type="submit" value="Vraag MMS op" />
</form>
<?
} else {
if (is_numeric($_GET['aflID'])) {
// Grab js/initialization.js.php?aflID=$_GET['aflID']
$headers = get_headers('http://player.omroep.nl/?aflID='.$_GET['aflID'], 1);
$cookies = $headers['Set-Cookie'];
$url = 'http://player.omroep.nl/js/initialization.js.php?aflID='.$_GET['aflID'];
$content = disguise_curl($url, $cookies);
$regexp = "/var\ securityCode\ \=\ '(\w{32})';/";
$i = preg_match($regexp, $content, $match);
$md5 = $match[1];
if (!empty($md5)) {
// Grab metaplayer.xml.php
$meta = 'http://player.omroep.nl/xml/metaplayer.xml.php?aflID='.$_GET['aflID'].'&md5='.$md5;
$metacontent = disguise_curl($meta, $cookies);
//echo $metacontent;
//$bbreg = "/<stream\ compressie_kwaliteit\=\'bb\'\ compressie_formaat\=\'wmv\'>(.*)</stream>\r\n/"
$xml = simplexml_load_string($metacontent);
//print_r($xml);
$streams = $xml->xpath('//stream[@compressie_kwaliteit="bb" and @compressie_formaat="wmv"]');
$stream = $streams[0][0];
// Programmanaam
$naam = $xml->xpath('//program');
$omroep = $xml->xpath('//omroep');
$info = $xml->xpath('//gids_tekst');
$genre = $xml->xpath('//genre');
$afl = $xml->xpath('//tab[@titel="Meer afleveringen"]/link');
//print_r($genre);
echo $omroep[0][0].' '.ucfirst($naam[0][0]).' (';
foreach($genre as $g) {
echo $g[0].' ';
}
echo ')<br /><br />';
echo '<div style="width: 600px;">'.$info[0][0].'</div><br />';
$mms = file_get_contents($stream);
$mmsregexp = '/<Ref\ href\ \=\ "(.*)"\/>/';
$j = preg_match($mmsregexp, $mms, $mmsurl);
echo '<a href="'.$mmsurl[1].'">'.$mmsurl[1].'</a><br /><br />Meer afleveringen:<br />';
foreach ($afl as $obj) {
$data = $obj->attributes();
//print_r($data);
echo '<a href="./omroep.php?aflID='.$data[0].'">'.$data[1].' '.$obj[0].'</a><br />';
}
} else {
trigger_error('Geen MD5 gevonden :\'(', E_USER_ERROR);
}
}
} |