您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP音乐采集(部分代码)_PHP

2025/7/11 22:47:31发布21次查看
采集
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;
}
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;$i5769;$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(/专辑:(.*)
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product