新浪网盘用户资源采集发布到dz论坛

1 364
dongdong
dongdong 2018-08-31 18:02
header("Content-type: text/html; charset=utf-8");
include('simple_html_dom.php');
$con=mysql_connect('ip','root','psd');
mysql_select_db('pan91');
mysql_query('set names utf8');
$page=1;   
get_data();
function get_data(){
$URL="http://vdisk.weibo.com/u/3103042815?page="; //采集目标站
$fid=2;                                       //大发3d版块--45:书籍小说;2:教程文档;37:源码模板;39:游戏音乐;36:软件应用
$uid=1;                                        //发帖人ID
$uname='motongbike';                           //发帖人
$time=time();                                  //发帖时间 
$content="这当然是[B]asd[/B]内容啦
从前....结束
";    //内容
$ip='127.0.0.1';                               //IP
$views=rand(0,100);                            //浏览次数
$htmlon=1;                                     // 是否支持HTML   1是支持. 要去后台给板块开启支持HTML
global $page;
$html = file_get_html($URL.$page);//--到100
foreach($html->find('div.sort_name_detail a') as $element){
$url="[url]".$element->href."[/url]";
$title="【新浪微盘】".$element->title;
//插入标题
$insert_thread="insert into pre_forum_thread(fid,posttableid,typeid,sortid,readperm,price,author,authorid,subject,dateline,lastpost,lastposter,views,replies,displayorder,highlight,digest,rate,special,attachment,moderated,closed,stickreply,recommends,recommend_add,recommend_sub,heats,status,isgroup,favtimes,sharetimes,stamp,icon,pushedaid,cover,replycredit) VALUES ('$fid','0','64','1','0','0','motongbike','1','$title','$time','$time','motongbike','$views','0','0','0','0','0','0','0','0','0','0','0','0','0','0','32','0','0','0','-1','-1','0','0','0')";
if(mysql_query($insert_thread)){
$tid=mysql_insert_id();
echo $tid.'<br>';
$select="select max(pid) from pre_forum_post_tableid";
$result=mysql_query($select);
$row=mysql_fetch_row($result);
$pid=$row[0]+1;
$insert_tableid="insert into pre_forum_post_tableid(pid) values ('$pid')";
if(mysql_query($insert_tableid)){
$insert_post="insert into pre_forum_post(pid,fid,tid,first,author,authorid,subject,dateline,message,useip,invisible,anonymous,usesig,htmlon,bbcodeoff,smileyoff,parseurloff,attachment,rate,ratetimes,status,tags,comment,replycredit,position) VALUES ('$pid','$fid','$tid','1','motongbike','1','$title','$time','$url','$ip','0','0','1','0','0','-1','0','0','0','0','0','','0','1',0)";

if(mysql_query($insert_post)){
echo "insert_post_ok";
}else{
echo mysql_error();
}
}else{
echo "insert_tableid".mysql_error();
}
}else{
echo "insert_thread".mysql_error();
}
}
if($page<22){
$page++;
get_data();
}

}



更多资源
标记失效
0
回帖