Soundcloud API PHP Integration
-
12-12-2019 - |
Question
I am currently trying to stream tracks from soundcloud to my new web app. 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>";
?
...and to follow the same echo statement format for the username, and permalink as well?
Solution
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 $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!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow