Deezer API - Taking Json and PHP values

Asked

Viewed 83 times

1

I’m trying to get some information from the API, I was able to filter some things, but for example, I’m trying to get to the 'preview' link to play 30 seconds of music and I can’t get to it, I’ve done so far :

<?php

$url = 'https://api.deezer.com/2.0/search?q=Alok';
$jsonStr = file_get_contents($url);
$jsonArr = json_decode($jsonStr, true);

$album = array();



foreach ($jsonArr['data'] as $row) {
    $album[] = $row['album'];//['cover_xl'];

}

echo '<pre>'.print_r($album, true).'</pre>';


?>

1 answer

0

I got it, actually, the access is direct.

foreach ($jsonArr['data'] as $row) {
    $album[] = $row['preview'];//['cover_xl'];

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.