This article mainly introduces the PHP Method for simple song searching. The example analyzes the function of php to query songs through the search interface of Sina music library, which has some reference value. For more information, see
This article mainly introduces the PHP Method for simple song searching. The example analyzes the function of php to query songs through the search interface of Sina music library, which has some reference value. For more information, see
This article describes how PHP implements simple song search. Share it with you for your reference. The specific implementation method is as follows:
<? Php header ('meta http-equiv = "content-type" content = "text/html; charset = gb2312 "'); if (isset ($ _ REQUEST ['submit ']) & isset ($ _ REQUEST ['key']) $ key = $ _ REQUEST ['key']; else $ key = 'Jay Chou '; $ 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 ';?>
<? Php foreach ($ data as $ one) {$ music = $ one-> MP3URL; $ music = file_get_contents ($ music ); $ music = str_replace ('iask _ music_song_url = "','', str_replace (' "; ','', $ music);?>
<? Php echo 'album _ NAME :'. $ one-> NAME. 'music_url :'. $ one-> NAME. ''. 'singer_name '. $ one-> SINGERCNAME;?>
<? Php }?>
I hope this article will help you with php programming.
,