时间:2021-05-26
<?PHP
set_time_limit(0);
mysql_connect("localhost","root","");
mysql_select_Db("music_36g");
$ip='127.0.0.1';
function_GetIP()
{
$ip=getenv("REMOTE_ADDR");
$ip1=getenv("HTTP_X_FORWARDED_FOR");
$ip2=getenv("HTTP_CLIENT_IP");
($ip1)?$ip=$ip1:null;
($ip2)?$ip=$ip2:null;
return$ip;
}
functionMakePassword($length=10)
{
$password='';
$chars=
array
(
"1","2","3","4","5","6","7","8","9","0",
"a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J",
"k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T",
"u","U","v","V","w","W","x","X","y","Y","z","Z"
);
$count=count($chars)-1;
srand((double)microtime()*1000000);
for($i=0;$i<$length;$i++)
{
$password.=$chars[rand(0,$count)];
}
return($password);
}
if(_GetIP()!=$ip)
{
exit("Can'tRun!");
}
for($i=2;$i<5769;$i++)//52738
{
$url="http://music.36g.net/SpecialInfo/showspecial".$i.".htm";
$File=@fopen($url,'rb');
if($File)
{
$makeFile=$buffer="";
$buffer="";
while($buffer=fread($File,4096))
{
$makeFile=$makeFile.$buffer;
}
@fclose($File);
preg_match("/src=\/uppic\/(.*)width=135/",$makeFile,$pic);#图片
#下载图片
if($pic[1]!='es/Nophoto.gif')
{
$p_url="http://music.36g.net/uppic/".$pic[1];
$File2=fopen($p_url,'rb');
if($File2)
{
$Buffer2=$makeFile2="";
while($Buffer2=fread($File2,4096))
{
$makeFile2=$makeFile2.$Buffer2;
}
fclose($File2);
$Filename2='./pic/'.$pic[1];
$Fp2=fopen($Filename2,'w+');
fwrite($Fp2,$makeFile2);
fclose($Fp2);
}
}
else
{
$pic[1]='';
}
preg_match("/专辑:<\/strong>(.*)<\/td><tdwidth=(\d+)rowspan=6/",$makeFile,$name);#专辑名称
$name=addslashes($name[1]);
preg_match("/歌手:<\/strong>(.*)<\/td><\/tr><tr><td>/",$makeFile,$songer);#歌手名称
preg_match("/(.*)<\/td><\/tr><tr><td>/",$songer[1],$songer_name);#歌手名称
preg_match("/发行公司:<\/strong>(.*)/",$songer[1],$company);#发行公司
preg_match("/发行时间<\/strong>:(.*)<\/td><\/tr>/",$makeFile,$date);#发行时间
preg_match("/(.*)<\/td>/",$date[1],$date2);#发行时间
preg_match("/<\/strong>(.*)/",$date[1],$language);#发行语言
preg_match("/专辑简介:<\/strong><\/td><tdcolspan=2>(.*)<\/td><\/tr><\/table><br>/",$makeFile,$descript);#专辑简介
$songer_name=addslashes($songer_name[1]);
$company=addslashes($company[1]);
$descript=addslashes($descript[1]);
#取得歌曲ID
preg_match_all("/download1\.asp\?id=(\d+)&which=BakDownUrl1/",$makeFile,$id2);#歌曲ID
$num=count($id2[1]);
for($jj=0;$jj<$num;$jj++)
{
$sql="insertintotx_musicsetmusicID='".$id2[1][$jj]."',specialID='$i',specialName='$name',songerName='$songer_name',orderByID='".$id2[1][$jj]."'";
//echo$id2[1][$jj]."<br>";
mysql_query($sql);
}
//echo$descript."<br><br>";
$sql="insertintotx_specialsetorderByID='$i',specialID='$i',specialName='$name',songerName='$songer_name',company='$company',date='$date2[1]',language='$language[1]',picture='$pic[1]',musicNum='$num',createDate='".time()."',description='$descript'";
echo$sql;
mysql_query($sql);
}
}
?>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
后台采集里设置采集模块中title或者其他的内容都可以设置为然后用下面的代码就可以读取到php的源了。index.php?clientid=name&url=.
从前面的我讲的采集原理大家可以看出,绝大多数采集程序都是靠分析规则来进行采集的,如分析分页文件名规则、分析页面代码规则。一、分页文件名规则防采集对策大部分采集器
本文实例讲述了php采集自中央气象台范围覆盖全国的天气预报代码。分享给大家供大家参考。具体分析如下:天气预报信息采集自中央气象台,信息准确,覆盖面广,代码简单,
最近一段时间,采集很热门,从新闻小偷,到音乐小偷,到新闻采集,Flash采集,都有他的踪影,现在还有很多的人对采集都很感兴趣,为了服务大家,我也正在写一套采集程
本文实例讲述了php将HTML表格每行每列转为数组实现采集表格数据的方法。分享给大家供大家参考。具体如下:下面的php代码可以将HTML表格的每行每列转为数组,