当前位置:   article > 正文

ua解析接口_网易云音乐在线解析接口

网易云音乐在线解析

if(isset($_GET['id']) && $_GET['id']!=''){

$musicId = $_GET['id'];

$url = "http://music.163.com/api/song/detail/?id={$musicId}&ids=%5B{$musicId}%5D&csrf_token=";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch, CURLOPT_POST, 0);

curl_setopt($ch, CURLOPT_TIMEOUT, 30);

$output = curl_exec($ch);

curl_close($ch);

$musicArr = json_decode($output);

//print_r($musicArr);

$musicJson['name'] = $musicArr->songs[0]->name;//专辑

$musicJson['url'] = $musicArr->songs[0]->mp3Url; //音乐链接

$musicJson['pic'] = $musicArr->songs[0]->album->picUrl;//音乐封面

$musicJson['singer'] = $musicArr->songs[0]->album->artists[0]->name;//歌手

$musicJson['album'] = $musicArr->songs[0]->album->name;//专辑

echo json_encode($musicJson);

}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/540454
推荐阅读
相关标签
  

闽ICP备14008679号