simple_html_dom.php下载就可以,百度一下你就知道
require_once "simple_html_dom.php";
function find($value)
{
$qurl='http://music.baidu.com/search?key='.$value;
$html1=file_get_html($qurl);
$div=$html1->find('span[class=song-title]',0);
$link1=$div->first_child ()->href;
$link2='http://music.baidu.com/'.$link1.'/download';
$html2=file_get_html($link2);
$download=$html2->getElementById('download');
$url=$download->href;
$title=$html2->find('span[class=fwb]',0)->plaintext;
$author=$html2->find('span[class=author_list]',0)->plaintext;
return array('title'=>$title,'author'=>$author,'url'=>substr($url,22));
}
$result = find("一首心歌");
//echo $result['title']."<br/>";
//echo $result['author']."<br/>";
//echo $result['url'];
这样大家可以自己试试,获取一下下载地址!

发表评论 取消回复