php文章採集

來源:互聯網
上載者:User

自家用的 php 採集程式呵呆把它拿出來吧   php採集代碼,php 採集器 ,必一下就可能變成php論壇採集程式,自動採集程式 php php採集原理是讀取遠程文章的內容然後正我們想要用東西,

<?php

 set_time_limit(0); //設定文檔永不到期

 $url   =$_POST["url"];//URL

 $start   =$_POST["start"];//開始

 $end   =$_POST["end"];//結束

 //$encode_start =$_POST["encode_start"]; //取得內容代碼開始

 $encode_end  =$_POST["encode_end"];//取得內容結束

 $type   =$_POST["select"];//主類

 $ztype   =$_POST["select2"];//子類

 $admin   =$_POST["admin"];//使用者

 $r_type   =$_POST['type'];

 $c_total  =0;

 

for($i=$start;$i<=$end;$i++){

 $getreal=$url.$i.".html";

 echo $getreal;

 echo "<br>";

 @sava_data(new_content(getcontent($getreal),$r_type,$encode_end),$type,$admin,$ztype);

 $c_total++;

}

echo "共採集".($c_total)."篇文章";

echo "<a href=# onclick=\"javascript:history.back();\">Back</a>";

 

//print_r( new_content(getcontent('http://www.diybl.com/course/4_webprogram/php/phpshil/2007828/69928.html'),'aa','aa'));

//echo 'x iloveyou<p></p><br>ffdafdafds';

function getcontent($url)

 {  

  $retmsg=file_get_contents($url);

  return $retmsg;

 }

 

function new_content($retmsg,$replace,$class){

 $r_type="-ddd";

 $start ="<input type=\"button\" value=\"ss索\" onClick=\"tosearch(document.all.wd2);\"><p>";

 $end  ="<strong><font color=\"#CC0000\">sss落</font></strong>";  

 $arr1 =explode($start,$retmsg);

 $arr2 =explode($end,$arr1[1]);

 $ts  =preg_replace("/<a href=(.+?)[^>]*>/","",$arr2[0]);/* 清除串連<a href=(.+?)[^>]*>*/  

 $ts  =preg_replace("/<img [^>]*>/im","",$arr2[0]);/* 清除串連*/ 

 $ts  =@str_replace("(sss",'',$ts);

   preg_match('/<TITLE>(.+?)<\/TITLE>/', $retmsg, $arr);/* 取得標題*/

 $p  =@str_replace("$replace",'',$arr[1]);

 $ts  =substr($ts,0,strlen($ts)-70);

 return $value =array($p,$ts); 

}

function sava_data($lvalue,$type,$admin,$ztype){

 $tsql ="select * from filecontent where title='".addslashes($lvalue[0])."'";

 $result =mysql_query($tsql) or die(mysql_error()); 

 if(!mysql_num_rows($result)){  

  $title_  =strip_tags($lvalue[0]);

  $content_ =addslashes($lvalue[1]);  

  @mysql_query("Insert into filecontent(title,content,filesendid,filesendtime,siteindex,systype,z_type) value('$title_','$content_','$admin','".date("Y-m-d")."','1','$type',$ztype)")  ;

 }}

原創:www.111cn.net

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.