在Soundcloud上显示喜爱曲目的嵌入代码

时间:2018-08-12 16:40:18

标签: php wordpress soundcloud

我已经能够使用以下代码在我的Soundcloud页面上显示收藏夹(或“喜欢的”)曲目的标题。但是,我也想为每个曲目嵌入播放器。有什么办法吗?

<?php

$clientid = "<insert_Client_ID>"; // Your API Client ID
$userid = "<insert_Souncloud_User_ID>"; // ID of the user you are fetching the information for


$soundcloud_url = "http://api.soundcloud.com/users/{$userid}/favorites.json?client_id={$clientid}";

$tracks_json = file_get_contents($soundcloud_url);
$tracks = json_decode($tracks_json);

 echo "<ul>";

    foreach ($tracks as $track) {
        echo "<li><a href='" . $track->permalink_url ."' target='_blank'>" . $track->title . "</a></li>";
    }
 echo "</ul>";

?>

0 个答案:

没有答案