$filemodtime){ $StrUpdate = true; return $StrUpdate; } else { $StrUpdate = false; return $StrUpdate; } } function html2specialchars($str){ // Flickr's Api tags aren't XML $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES)); return strtr($str, $trans_table); } function BadQuotes($content){ // Remove quotes from crappy regular expression $content = ereg_replace('"', "", $content); $content = trim($content); return $content; } function getFlickr($band,$Num) { // Search Flickr for the photos tagged with $band $FlickrURL = FLICKRURL; $FlickrKey = FLICKRKEY; $FlickrXML = $Num.".xml"; $FlickrParams = "method=flickr.photos.search&format=xmlrpc&tags=".$band."&per_page=4&extras=owner_name&tag_mode=all&sort=date-posted-asc&api_key=".$FlickrKey; $StrFlickr = cacher($FlickrXML); if($StrFlickr){ $ch = curl_init(); $fp = fopen($FlickrXML, "w"); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$FlickrParams); curl_setopt($ch, CURLOPT_URL,$FlickrURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FILE, $fp); $content = curl_exec ($ch); curl_close ($ch); } $fp = fopen($FlickrXML, "r"); while(!feof($fp)) { $content .= fgets($fp); } fclose($fp); $itemregexp = ""; $match_count = preg_match_all($itemregexp, $content, $items); if($match_count){ for ($i=0; $i< $match_count; $i++) { $StrPhID = BadQuotes($items[1][$i]); $StrOwnerId = BadQuotes($items[2][$i]); $StrSecrect = BadQuotes($items[3][$i]); $StrServer = BadQuotes($items[4][$i]); $StrTitle = BadQuotes($items[5][$i]); $StrOwnerName = BadQuotes($items[6][$i]); echo"\"$StrOwnerName"; } } else { echo"

Can you believe it! No one has tagged any photos with $band! Either that or Flickr is having another massage, can you believe that guy? I mean really, the dude must be like rubber by now.

"; } } function audioFlickrscrobbler(){ //This is where the magic happens! $AudioURL = AUDIOURL.AUDIORSS ; $CachedScrobbler = CACHEDSCROBBLER; $NumOfPhotos = NUMOFPHOTOS; $FavBand1 = FAVBAND1; $FavBand2 = FAVBAND2; $FavBand3 = FAVBAND3; // Check the locally cached version of your Audioscrobbler RSS feed $StrAudio = cacher($CachedScrobbler); if($StrAudio){ $ch = curl_init(); $fp = fopen($CachedScrobbler, "w"); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_URL,$AudioURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FILE, $fp); $data = curl_exec ($ch); curl_close ($ch); } $data = ''; $fp = fopen($CachedScrobbler, "r"); while(!feof($fp)) { $data .= fgets($fp); } fclose($fp); if(!$data){ exit("

Oh No!

\n

I canna get to audioscrobbler captin!

"); } $itemregexp = "/.*?.*?(.*?)<\/dc:title>.*?<\/dc:creator>.*?<\/mm:Artist>/si"; $match_count = preg_match_all($itemregexp, $data, $items); if($match_count){ for ($i=0; $i< $NumOfPhotos; $i++) { $StrBand = $items[1][$i]; echo "

Photo's based on $StrBand

"; getFlickr($items[1][$i],$i); echo"
"; } } else { echo"

Bummer

\n

I haven't been listening to any music so here's a couple of my current favourites

"; echo "

Photo's based on $FavBand1

"; getFlickr($FavBand1,1); echo"
"; echo "

Photo's based on $FavBand2

"; getFlickr($FavBand2,2); echo"
"; echo "

Photo's based on $FavBand3

"; getFlickr($FavBand3,3); echo"
"; } } ?> AudioFlickrscrobbler