I've been trying (for a few days now) to display one item out of a JSON query, but because I'm terrible with the syntax and functions I'm failing...
My code looks as below
<p>I'm currently listening to
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$string = file_get_contents("http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=matt1319&api_key=de676fee34a484f0c7ea2bd1c959d2d2&format=json&limit=1");
$json = json_decode($string, true);
echo *****;
?>
</p>
I want to get my most recently played song out of last.fm which is...
recenttracks.track[0].artist['#text'] (if I'm currently listening or..)
recenttracks.track.artist['#text'] (If I'm not currently listening to a song)
Any help of pointing in the right direction would be great. As I'm fairly new to PHP (background in HTML) I'll be very grateful for some help.