I want to connect with the last fm API and pulling the information from the JSON file.
Example file : [Last FM API JSON File][1]
on my php file I get the correct information via this code :
<?$get = file_get_contents('http://ws.audioscrobbler.com/2.0/?
method=artist.getinfo&artist=Ed
Sheeran&api_key=63692beaaf8ba794a541bca291234cd3&format=json');
$get = json_decode($get);
foreach($get->artist->tags->tag as $tags) { $thetag = (array) $thetag;?>
<? echo $thetag['name'];?>
<?} ?>
At the moment this will echo each individual tag for that artist, for example : easy listening and grime
What i am wondering is there any way to create a string that contains $thetag whilst also putting a comma inbetween?
$newstring = "easy listening, grime"
e.t.c
My plan is to create the string and then use php code to search my database and display records where the tag column contains any of those tags. Any idea how is it possible?
[1]: http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=Ed Sheeran&api_key=63692beaaf8ba794a541bca291234cd3&format=json
This is tested and working and is one of a few possible methods...