>  기사  >  백엔드 개발  >  php 将火车头采集db3数据导入到dedecms完整代码_PHP教程

php 将火车头采集db3数据导入到dedecms完整代码_PHP教程

WBOY
WBOY원래의
2016-07-20 11:07:271706검색

php教程 将火车头采集db3数据导入到dedecms完整代码
$path ="d:pdoSpiderResult.db3";
 $conn = new PDO("sqlite:$path");
 $array=array('','',''); 

 if( $conn )
 {
  //echo ('connection pdo success');
 }
 else
 {
  echo ('cnnection pdo fail ,plase check database server!');
 }
 $count=0;
 $sp = new SplitWord();
 foreach ($conn->query('SELECT * FROM content limit 160,80') as $row)
 {
  
  // baise info
  
  $softtitle = mysql教程_escape_string(mb_convert_encoding($row[3],'gbk','auto')).'-js相册';//title
  
  //file title
  
  $softcontent =  str_replace('Image/','http://g.111cn.cn/javascript教程/Image/',mb_convert_encoding($row

[4],'gbk','auto'));
  
  //file size of size
  
  $softsize = '未知';
  
  // file downurl
  
  $softurl = str_replace('.zip','',$row['address']);
  $filetype='.rar';
  $softpath='http://g.111cn.cn/javascript/'.$softurl.$filetype;
  $view ='
效果预览地址

target=_blank>'.$softtitle.'

';//效果预览地址

      preg_match_all("/(src|SRC)=["|'| ]{0,}((.*).(gif|jpg|jpeg|png|bmp))/isU",$softcontent,$img_array);
  $thum = str_replace("'",'',str_replace('"','',$img_array[2][0]));
  $softlinks = mysql_escape_string("{dede:link islocal='1' text='$localhost'}".$softpath."{/dede:link}");
  $a = strip_tags($softcontent);
  $b = $sp->SplitRMM($softtitle);
  $keywords = str_replace(' ',',',$b);
  
  $desciption = '';//desc + split word
  $introduce =$softcontent.$desciption.$view;
  $os ='Win2003,WinXP,Win2000,Win9X';
  //call out link  descript 
   
  $addsoft = "Insert into d_addonsoft(typeid,filetype,language,softtype,accredit,

os,softrank,officialUrl,officialDemo,softsize,softlinks,introduce,templet,userip,redirecturl)";
   $addsoft .=" values

('$typeid','$filetype','$language','','','$os','3','','','$softsize','".$softlinks."','$introduce','','222.103.69.94','')";

   mysql_query( $addsoft ) or die('addsoft'.$addsoft.mysql_error());//.$addsoft
   $newid = mysql_insert_id();
  
   // Read insert new id
          
   $sortrank = time();
  
   //Read the minutes and seconds when the system is currently
  
   $click = mt_rand(1000,10000);
  
   // Random Clicks 1000 , 10000 btween   
  
  
   $archives = "Insert into d_archives

(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,litpic,writer,source,pubdate,senddate,mid,descripti

on,keywords)";  
   $archives.=" values

('$newid','$typeid','0','$sortrank','p','1','3','0','$click','0','$softtitle','$thum','$write','unkown','$sortrank','$sortran

k',1,'$desciption','$keywords')";
  
   mysql_query($archives) or die('archives '.$archives.'|'.mysql_error()); //$archives.
   $arctiny = "Insert into d_arctiny(id,typeid,typeid2,arcrank,channel,senddate,sortrank,mid) values

($newid,$typeid,0,0,3,'$sortrank','$sortrank',1)";
  
   mysql_query( $arctiny) or die( 'arctiny'.$arctiny.mysql_error());//$arctiny.
 
 }
 echo '总共有多条',$count,"不存地的";

本站原创转载注明来源.net教程">www.bkjia.com


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/444966.htmlTechArticlephp教程 将火车头采集db3数据导入到dedecms完整代码 $path =d:pdoSpiderResult.db3; $conn = new PDO(sqlite:$path); $array=array('','',''); if( $conn ) { //echo ('connec...
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.