Kung-Tunes is an AppleScript Studio created OSX donation-ware utility to retrieve the currently played iTunes track and upload it to a
webserver.
The latest version now supports recently played tracks. This is how I configured it to upload the tracklist as data to be parsed on the server.
Paste this into the Current Track Format and Recent Tracks Format fields.
<?php
$tracklist['^d']['title'] = '^t';
$tracklist['^d']['artist'] = '#p^p#p';
$tracklist['^d']['composer'] = '#w^w#w';
$tracklist['^d']['album'] = '#a^a#a';
$tracklist['^d']['year'] = '#y^y#y';
$tracklist['^d']['time'] = '#l^l#l';
$tracklist['^d']['genre'] = '#g^g#g';
$tracklist['^d']['stream_url'] = '#u^u#u';
$tracklist['^d']['file'] = '#f^f#f';
$tracklist['^d']['rating'] = '#r^r#r';
$tracklist['^d']['count'] = '#c^c#c';
?>`</pre>
Set it to upload the the resultant file as php (kungtunes.php) and use something like this to get the data back out again:
<pre>`<?php
include ('./kungtunes.php');
print '<pre>';
foreach ($tracklist as $date=>$track_data) {
extract ($track_data);
print "$date: $title - $artist - $album\n";
}
print '</pre>';
?>
`</pre>
You can get the most recently played track with this:
<pre>`<?php
include ('./kungtunes.php');
$date_keys = array_keys ($tracklist);
$lastplayed = $date_keys[0];
$track_data = $tracklist[$lastplayed];
extract ($track_data);
print "$lastplayed: $title - $artist - $album\n";
?>
I’ve got mine here: Tim’s most recently listened to tunes, and the most recently played track listed on this page.