[英]Soundcloud API PHP Integration
I am currently trying to stream tracks from soundcloud to my new web app. 我目前正在尝试将音轨从soundcloud流式传输到新的Web应用程序。 I currently am able to get the album cover but now I am need to get the user name, track title, and permalink to also show up under the album cover. 我目前能够获得专辑封面,但是现在我需要获取用户名,曲目标题和永久链接,以便也可以在专辑封面下显示。 This is my code so far 到目前为止,这是我的代码
<body onload="setupBlocks();">
<?php
if(isset($tracks)){
foreach($tracks as $track){
debug($track['stream_url']);
debug($track['artist']);
echo '<div class="block">';
echo "<p><img src='".$track['artwork_url']."' width='275' height='125' /></p>";
Do I need to just do another echo statement echo "<p><src='".$track['title']."'/></p>";
我是否需要做另一个echo语句echo "<p><src='".$track['title']."'/></p>";
? ?
...and to follow the same echo statement format for the username, and permalink as well? ...并为用户名和永久链接遵循相同的echo语句格式?
Yup. 对。 If you have a track resource already, you have access to all the information you need. 如果您已经拥有跟踪资源,则可以访问所需的所有信息。 Just issue some more echo statements like the following: 只需发出更多如下所示的echo语句:
echo $track['title'];
echo $track['user']['username'];
echo $track['permalink_url'];
If you'd like to see all of the fields available, you could try the following debug statement: 如果您想查看所有可用字段,则可以尝试以下调试语句:
print_r($track);
Hope that helps! 希望有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.