Home >php教程 >PHP源码 >简单的PHP搜歌代码

简单的PHP搜歌代码

PHP中文网
PHP中文网Original
2016-05-25 17:10:001167browse

代码

<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;?>

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