-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
29 lines (22 loc) · 732 Bytes
/
index.php
File metadata and controls
29 lines (22 loc) · 732 Bytes
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
<?php
/*
YLE News broadcast M3U generator
Markus Vuorio <markus.vuorio@gmail.com>
Joel Lehtonen <joel.lehtonen@koodilehto.fi>
Following example code from http://emmettbutler.com/threestegosaurusmoon/?p=955
*/
function getMedia($feed)
{
$ret = array();
// retrieve search results
if($xml = simplexml_load_file($feed)) {
$result = $xml->xpath("/rss/channel/item[1]/enclosure/@url");
return (string)$result[0];
}
}
//TODO: Read channel and language info from GET parameters and pass them to getFeedURL
$feedurl = 'http://feeds.yle.fi/areena/v1/series/1-1440981.rss?lang=fi';
//TODO: Get program filter string from GET parameters and pass it to getMedia
$media = getMedia($feedurl);
header('Location: '.$media);
?>