Home  >  Article  >  Backend Development  >  html网页音乐播放器自带播放列表_PHP教程

html网页音乐播放器自带播放列表_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:29:351827browse

基于网页的音乐播放器demo  http://pan.baidu.com/s/1dDgm7HR

自己diy了一个手机端在线音乐播放器演示地址http://shanxi2014.com/zhuandizhi/dom.php

全面支持手机端浏览器。

主要修改引用路径(不要修改文件相对存放地址)

第二就是正则拼接参数了



































搜狗音乐地址获取

php
$query=$_GET['s'];
$q= mb_convert_encoding($query,"GBK","UTF-8");
$ew=urlencode($query);
$jsrc = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q={$ew}";
$json = file_get_contents($jsrc);
$jset = json_decode($json, true);
$src=$jset["responseData"]["results"][0]["url"];
$image="
html网页音乐播放器自带播放列表_PHP教程
"; $query=urlencode($query); $url="http://mp3.sogou.com/music.so?query={$query}"; function curl_get($url, array $get = NULL, array $options = array()) { $defaults = array( CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get), CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_TIMEOUT => 4 ); $ch = curl_init(); curl_setopt_array($ch, ($options + $defaults)); if( ! $result = curl_exec($ch)) { trigger_error(curl_error($ch)); } curl_close($ch); return $result; } $html=curl_get($url,array(), array()); iconv("GB2312","UTF-8//IGNORE",$html); $c="+onclick=\"qqDownload.*http://cc\.stream\.qqmusic\.qq\.com.*\.m4a\?fromtag=52+i"; $elemment=$html; if (preg_match_all($c, $elemment,$matches)){$i=0; $a = array(); $t=array(); foreach ($matches[0] as $val) { $val=explode("@@", $val, 11); $t[$i]="$val[10]}\" class=\"btn btn-red btn-round\">{$val[1]}
"; $i++; $val[1]=$image.$val[1]; $a[$i]="{title:\"{$val[1]}\",". "m4a:\"{$val[10]}\"},"; } } ?>

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/771653.htmlTechArticle基于网页的音乐播放器demo http://pan.baidu.com/s/1dDgm7HR 自己diy了一个手机端在线音乐播放器演示地址http://shanxi2014.com/zhuandizhi/dom.php 全面支持手...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn