- file_get_contents: documentation ( source)
- json_decode: documentation ( source)
- print_r: documentation ( source)
- http_build_query: documentation ( source)
<?php
$url = 'http://ws.audioscrobbler.com';
$endpoint = '2.0';
$params = array(
'method' => 'user.getrecenttracks',
'user' => 'djekl',
'api_key' => 'ec23317a230c09ebf945ca738d24243e',
'format' => 'json',
'limit' => '200',
);
$url = $url . '/' . $endpoint . '/?' . http_build_query($params);
$json = file_get_contents($url);
if ($json = json_decode($json)) {
print_r($json);
}