I am trying to track downloads of MP3 Podcasts in iTunes. I have created a simple codeignitor site which generates URLS like:
www.site.com/podcasts/download/[id].mp3
The script takes the ID out of the URL, checks it exists in the DB - Gets the URL of the files and then does the following:
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 01 Jan 2011 01:01:01 GMT");
header('Content-type: audio/mpeg');
header('Content-Disposition: attachment; filename=episode'.$id.'.mp3"');
readfile($this->podcast_model->get_strPodcastFileName());
If you hit the URL in a browser it works and the file starts to download, but when putting 1 link into iTunes it starts saying "Downloading 0%" but does not download?
The 1 thing to note is the method: $this->podcast_model->get_strPodcastFileName() returns a HTTP:// link and not a link to a file on the server, also the HTTP address is not on the same server as the script. Although this is working when downloading the files via the browser as I said above.
Does anyone have any ideas?
Thanks James