<?php
/**
* @author www.qqzer.com
* @copyright 2010
*/
$title=trim($_GET['title']);
$title=urlencode($title);
$TheUrl="http://mp3.baidu.com/m?f=ms&rf=idx&tn=baidump3&ct=134217728&lf=&rn=&word=". $title."&lm=-1";
function GetPage($url){
$getpage=file_get_contents($url);
if ($getpage==false) {
return "----------------------------获取内容失败--------------------------";
}
return $getpage;
}
function GetCon($str,$x,$y){
$tem=strstr($str,$x);
return substr($tem,0, strpos($tem,$y));
}
$TheThie=GetPage($TheUrl);
$TheBody=GetCon($TheThie,"<table border=0 cellpadding=0 cellspacing=0 id=Tbs rules=rows>","</table>");
$pat = '/box.zhangmen.baidu.com//m/?word=(.*?),(.*?),,/[/i';
preg_match_all($pat, $TheBody, $m);
for($i=0;$i<count($m[2]);$i++ ){
echo '<li>'.$m[2][$i].'</a>';
}
?>