I'm trying to read the iTunes XML file with PHP. I want to extract particular bits of information. Such as the Name, Artist and Album. How would I do this? I found this which works quite well when parsing the whole file. I thought perhaps using this to create a whole new XML file which is easier to read.
But there must be a better way.
The XML structure for a track looks like this:
<dict>
<key>Track ID</key><integer>6136</integer>
<key>Name</key><string>The Boy Who Destroyed the World</string>
<key>Artist</key><string>AFI</string>
<key>Album Artist</key><string>AFI</string>
<key>Composer</key><string>AFI</string>
<key>Album</key><string>Tony Hawk Pro Skater 3</string>
<key>Genre</key><string>Punk Rock</string>
<key>Kind</key><string>MPEG audio file</string>
<key>Size</key><integer>2971924</integer>
<key>Total Time</key><integer>185364</integer>
<key>Track Number</key><integer>3</integer>
<key>Year</key><integer>1999</integer>
<key>Date Modified</key><date>2009-08-20T15:03:20Z</date>
<key>Date Added</key><date>2009-08-20T15:03:20Z</date>
<key>Bit Rate</key><integer>128</integer>
<key>Sample Rate</key><integer>44100</integer>
<key>Play Count</key><integer>34</integer>
<key>Play Date</key><integer>3332385360</integer>
<key>Play Date UTC</key><date>2009-08-06T05:36:00Z</date>
<key>Sort Name</key><string>Boy Who Destroyed the World</string>
<key>Persistent ID</key><string>9E590180768D4AD8</string>
<key>Track Type</key><string>File</string>
<key>Location</key><string>FilePath</string>
<key>File Folder Count</key><integer>4</integer>
<key>Library Folder Count</key><integer>1</integer>
</dict>