I'm creating a music based application, and i'm trying to access the iTunes api to return a link to purchase an album, that is generated dynamically based on the album clicked on (which works fine, and generates a link to the correct JSON data). An Example link
What i can't get my head around is the accessing of the 'collectionViewUrl' key in the JSON, which i simply want to set as the href of a link that appears after the album art is selected, which will be scored in; $topalbums[$i]['iTunes'] = ....
I've tried using json_decode
to access the data but whenever I try to access the key I need i get no return. Am I missing something simple with this?
==================================
(My current code for this section)
$iTunes_link_prefix = "https://itunes.apple.com/search?country=GB&media=music&entity=album&limit=1&artist=";
for ($i = 0; $i < 6; $i++) {
$topalbum[$i]['title'] = $xml['top_albums']->topalbums->album[$i]->name;
$topalbum[$i]['image'] = $xml['top_albums']->topalbums->album[$i]->image[3];
$json_link = $iTunes_link_prefix . $artist . "&term=" . urlencode($topalbum[$i]['title']);
$topalbum[$i]['itunes'] = (Contents of the collectionViewUrl Key)
}