各类知识收集,PHP技术分享与解决方案各类知识收集,PHP技术分享与解决方案各类知识收集,PHP技术分享与解决方案

Str Tom,为分享PHP技术和解决方案,贡献一份自己的力量!
收藏本站(不迷路),每天更新好文章!
当前位置:首页 > CMS教程 > PHP

http://www.12306.cn/mormhweb/kPHP音乐采集部分代码

管理员 2023-09-05
PHP
128

http://www.12306.cn/mormhweb/kPHP音乐采集部分代码

内容导读

收集整理的这篇技术教程文章主要介绍了http://www.12306.cn/mormhweb/kPHP音乐采集部分代码,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4272字,纯文字阅读大概需要7分钟

内容图文

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;
}
function MakePassword($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't Run!");
}
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("/专辑:(.*) $name = addslashes($name[1]);
preg_match("/歌手:(.*)/",$makeFile,$songer);#歌手名称
preg_match("/(.*)</td></tr>/",$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> (.*)</td></tr></table>
/",$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 = " insert into tx_music set musicID='".$id2[1][$jj]."',specialID='$i',specialName='$name',s
//echo $id2[1][$jj]."
";
mysql_query($sql);
}
//echo $descript."

";
$sql = " insert into tx_special set orderByID='$i',specialID='$i',specialName='$name',s
echo $sql;
mysql_query($sql);
}
}
?>

以上就介绍了http://www.12306.cn/mormhweb/k PHP音乐采集部分代码,包括了http://www.12306.cn/mormhweb/k方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

内容总结

以上是为您收集整理的http://www.12306.cn/mormhweb/kPHP音乐采集部分代码全部内容,希望文章能够帮你解决http://www.12306.cn/mormhweb/kPHP音乐采集部分代码所遇到的程序开发问题。 如果觉得技术教程内容还不错,欢迎将网站推荐给程序员好友。

内容备注

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

相关推荐

扫码关注

qrcode

QQ交谈

回顶部