Created
November 23, 2012 08:44
-
-
Save monbro/4134596 to your computer and use it in GitHub Desktop.
Grab (and Download) latest MP3 Locations from FM4 Unlimited / Soundpark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$urls = array ("http://onapp1.orf.at/webcam/fm4/fod/unlimited.xspf", | |
"http://onapp1.orf.at/webcam/fm4/fod/soundpark.xspf"); | |
function downloadFile ($url, $path) { | |
$newfname = $path; | |
$file = fopen ($url, "rb"); | |
if ($file) { | |
$newf = fopen ($newfname, "wb"); | |
if ($newf) | |
while(!feof($file)) { | |
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 ); | |
} | |
} | |
if ($file) { | |
fclose($file); | |
} | |
if ($newf) { | |
fclose($newf); | |
} | |
} | |
function grabfile($url) { | |
$xml = simplexml_load_file($url); | |
foreach($xml->trackList->track as $track) { | |
$podcast[] = array( | |
'mp3' => (string)$track->location, | |
'img' => (string)$track->image, | |
'title' => (string)$track->title | |
); | |
// Download Episode if wanted, make sure apache user can write in dir 'dl' | |
// to download uncomment | |
// downloadFile((string)$track->location,'dl/'.basename((string)$track->location)); | |
} | |
return $podcast; | |
} | |
foreach($urls as $url) { | |
$podcasts[] = grabfile($url); | |
} | |
// Get Arrays with all episodes available | |
// var_dump($podcasts); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it must be http://fm4.orf.at/radio/stories/fm4unlimited now