【问题标题】:Get song information from soundcloud, having song id从 soundcloud 获取歌曲信息,拥有歌曲 ID
【发布时间】:2016-08-07 09:41:39
【问题描述】:

我从 Soundcloud 中存储了歌曲 ID,但我想从 Soundcloud 中获取这些歌曲 ID:s 的信息。

如何使用 PHP 从艺术家那里获取歌曲名称、艺术家、封面?

可能有人有任何例子吗?所有的帮助都会得到满足。

【问题讨论】:

  • 你有没有尝试写一些代码?
  • 还没有,我一直在尝试在线搜索,但找不到任何容易的东西
  • 你检查soundcloud's api了吗?

标签: javascript php soundcloud


【解决方案1】:

从 SoundCloud 向其 API 发送 GET 请求获取歌曲信息应该可以正常工作。

卷曲

$ curl "http://api.soundcloud.com/tracks/{track_id}?client_id={YOUR_CLIENT_ID}"

PHP

<?php

// Get cURL resource
$curl = curl_init();

// Set some options
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'http://api.soundcloud.com/tracks/{track_id}?client_id={YOUR_CLIENT_ID}'
));

// Send the request & save response to $resp
$resp = curl_exec($curl);

// Close request to clear up some resources
curl_close($curl);

?>

API 参考 - https://developers.soundcloud.com/docs/api/reference#tracks

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多