I've gone through the script now, modified it and it works! Thanks a lot for helping me out.
Here you can look at it:
http://forgottenjewels.sytes.net
(Enter and chose Playlist in the menu and scroll down to bottom of page)
There is one minor thing left though. I would like to have the numbers presented in another format. Now it looks like...
1 - Black Sabbath (1980) - Children Of The Sea
I want it to look like:
001 - Black Sabbath (1980) - Children Of The Sea
How do I change this? This is the code:
<?php
@ini_set('memory_limit', '16M');
$username = "XXX";
$password = "XXX";
$url = "http://www.live365.com/cgi-bin/api_track_stats.cgi?version=1&action=tracks&filter=current&member_name=$username&password=$password";
if (!function_exists("file_get_contents")) {
function file_get_contents($filename, $use_include_path = 0) {
$data = ""; // just to be safe. Dunno, if this is really needed
$file = @fopen($filename, "rb", $use_include_path);
if ($file) {
while (!feof($file)) $data .= fread($file, 1024);
fclose($file);
}
return $data;
}
}
if($data = @file_get_contents($url)) {
$p = xml_parser_create();
xml_parse_into_struct($p, $data, $vals, $index);
xml_parser_free($p);
for($i=0; $i<count($index["ARTIST"]); $i++) {
$tracks[$i]["rating"] = $vals[$index["POWER_RATING"][$i*3+2]]["value"];
$tracks[$i]["artist"] = $vals[$index["ARTIST"][$i]]["value"];
$tracks[$i]["title"] = $vals[$index["TITLE"][$i]]["value"];
}
$as_of = explode("-", $vals[$index["AS_OF"][0]]["value"]);
unset($vals);
unset($index);
rsort($tracks);
$fp2 = fopen("O-topten.inc", "w");
fwrite($fp2, "\n<? // " . $as_of[2] . $as_of[0] . $as_of[1] . " ?>\n");
fwrite($fp2, "<big><strong><font color=#752020 size=2>Top Ten Tracks as of " . date ("F d, Y", strtotime($as_of[2] . $as_of[0] . $as_of[1])) .":<p></strong></big>\n");
fwrite($fp2, "\n");
for($i=0; $i<10; $i++) {
$j = $i + 1;
fwrite($fp2, "<font color=#666666 size=2><li>" . $j . " - ");
fwrite($fp2, "" . $tracks[$i]['artist'] . " - ");
fwrite($fp2, "" . $tracks[$i]['title'] . "<br></li>");
fwrite($fp2, "\n");
}
fwrite($fp2, '<p><HR NOSHADE width="745" height="1" align=left color="#666666"><p><font color=#666666 size=1>* Statistics generated daily from ranking based on votes in the Live 365 playlist window');
fwrite($fp2, "\n");
fclose($fp2);
} else {
echo "Couldn't connect to Live365.";
}
?>