首頁  >  文章  >  後端開發  >  php透過新浪樂庫搜尋介面查詢歌曲的功能

php透過新浪樂庫搜尋介面查詢歌曲的功能

墨辰丷
墨辰丷原創
2018-06-08 13:41:041650瀏覽

本篇文章主要介紹php透過新浪樂庫搜尋介面查詢歌曲的功能,有興趣的朋友參考下,希望對大家有幫助。

具體如下:

<form name="" method="post" action="">
<input name="key" type="text" /> <input name="submit" type="submit" value="搜歌" />
</form>
<pre class="brush:php;toolbar:false">
<?php 
header(&#39;meta http-equiv="content-type"content="text/html; charset=gb2312"&#39;);
if( isset( $_REQUEST[&#39;submit&#39;]) && isset( $_REQUEST[&#39;key&#39;]))
$key = $_REQUEST[&#39;key&#39;];
else $key = &#39;周杰伦&#39;;
$url = &#39;http://music.sina.com.cn/yueku/search/getRecommendXml1dot0.php?q=&#39;.urlencode($key).&#39;&l=50&json=json&#39;;
$data = file_get_contents( $url);
$data = json_decode( $data);
if( !count($data)) echo &#39;Not found&#39;;
?>
MP3URL; $music = file_get_contents( $music); $music = str_replace('iask_music_song_url="' , '', str_replace('";' , '', $music)); ?>

NAME.' MUSIC_URL : '.$one->NAME.''.' SINGER_NAME'.$one->SINGERCNAME;?>

總結:以上就是這篇文章的全部內容,希望能對大家的學習有所幫助。

相關推薦:

##PHP模擬asp中response類別的方法

PHP中如何取得使用者IP位址

PHP的變數及日期處理案例

以上是php透過新浪樂庫搜尋介面查詢歌曲的功能的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn