This article mainly introduces the function of PHP to query songs through the Sina Music Library search interface. Interested friends can refer to it. I hope it will be helpful to everyone.
The details are as follows:
<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('meta http-equiv="content-type"content="text/html; charset=gb2312"'); if( isset( $_REQUEST['submit']) && isset( $_REQUEST['key'])) $key = $_REQUEST['key']; else $key = '周杰伦'; $url = 'http://music.sina.com.cn/yueku/search/getRecommendXml1dot0.php?q='.urlencode($key).'&l=50&json=json'; $data = file_get_contents( $url); $data = json_decode( $data); if( !count($data)) echo 'Not found'; ?>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;?>
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
PHP simulates the response class method in asp
How to get the user IP in PHP Address
PHP variable and date processing case
The above is the detailed content of PHP function to query songs through Sina Music Library search interface. For more information, please follow other related articles on the PHP Chinese website!