php知道与问问的采集插件代码

募集在这几天的cms中都时临时用到哦,上边大家就来走访关于php 正则说明式
取标题,关键词,内容代码源码哦。

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“;
<html xmlns=”;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″
/>
<title>php教程 扩充数量保存到mysql教程数据实例教程</title>
<style
type=”text/css教程”>
<!–
body {
 margin-left: 0px;
 margin-top: 10px;
 margin-right: 0px;
 margin-bottom: 0px;
}
td{
 padding:2px;
 }
body,td,th {
 font-size: 12px;
}
–>
</style></head>

近些日子发觉知道和咨询小偷的本子更加的多了!!
看过七个百度小偷的网址也高达了pr6。收音和录音十万多!!
在经过 荐礼啦 三十天的实践之后 开采百度对那么些的确挺谈得来的。
从网址访谈来看 超多也是从百度查寻来的!
因而用理解和咨询来填充网址内容照旧有效的。
于是本身支付了三个明了 问问的征集插件
标准上切合 php+mysql 並且文章是在三个表的次序
驾驭搜罗代码
复制代码 代码如下:
session_start();
header(“content-type:text/html;charset=gbk”);
require(“stole_config.php”);
require(“conn.php”);
require(“keyword.php”);
$searchStr=$_GET[“searchStr”];
$ss=explode(” “,$searchStr卡塔尔国;//拆分寻找关键字
$word=””;//关键字设为空
foreach($ss as $key=>$t)
{
if($key>0)
{
$word .=”+”;
}
$word .=urlencode($t);
}
$jl=intval($_GET[‘jl’]);
if(isset($_GET[‘page’]))
{
$page=intval($_GET[‘page’]);
}else{
$page=1;
}
$rs=intval($_GET[‘rs’]);
if($rs>=10)
{
$rs=0;
$page++;
}
if($page>76)
{
echo “采群集束 ${jl}”;
exit();
}
if(!empty($searchStr卡塔尔国卡塔尔(قطر‎//若是搜索
{
//获取难点页面
$content=@file_get_contents(“);
//获取难点列表
preg_match_all(“/$uid=$uid[1];//获取详细页作品
$uid=$uid[$rs];
//决断数据是还是不是留存
$suid=”bd{$uid}”;
$sct=mysql_query(“select count(*) from {$table_prefix}c_article
where suid=’$suid’ “);
$sct=mysql_fetch_array($sct);
$sct=$sct[0];
if($sct==0)
{
$content=@file_get_contents(“http://zhidao.baidu.com/question/”.$uid.”.html”)
;
$arr=explode(”,$content);
$art_title=$arr[1];
$arr=explode(”,$art_title);
$art_title=$arr[0];//获取标题结束
//决断内容是不是顺应
$word_arr=explode(“,”,$cj_word);
$word_allow=false;//早先化是或不是允许采摘
$word_count=count($word_arr卡塔尔;//关键字总量
for($i=0;$i{
if(substr_count($art_title,$word_arr[$i])>0)
{
$word_allow=1;
澳门新葡萄京官网首页,$i=$word_count;
}
}
if($word_allow卡塔尔//若是满意条件
{
$arr=explode(‘.html/iUs%22,$content,$uid))

//获取标题$inarr =
array(卡塔尔(قطر‎;preg_match(/title(.*)/title/isU,$body,$inarr);if(isset($inarr[1])){$redatas[‘title’]
= $inarr[1];}

<body>
<table width=”98%” border=”0″ align=”center” cellpadding=”0″
cellspacing=”1″ bgcolor=”#F2F2F2″ >
  <form id=”form1″ name=”form1″ method=”post”
action=””><tr>
    <td width=”15%” height=”26″ align=”center”
bgcolor=”#FFFFFF”>标 题:</td>
    <td width=”85%” bgcolor=”#FFFFFF”>
      <label>
        <input type=”text” name=”title” />
        </label>    </td>
  </tr>
    <tr>
      <td height=”26″ align=”center”
bgcolor=”#FFFFFF”>关键词:</td>
      <td bgcolor=”#FFFFFF”><label>
        <input name=”keyword” type=”text” id=”keyword” size=”50″
/>
      </label></td>
    </tr>
    <tr>
      <td height=”26″ align=”center” bgcolor=”#FFFFFF”>描
述:</td>
      <td bgcolor=”#FFFFFF”><label>
        <textarea name=”desc” cols=”50″ rows=”4″
id=”desc”></textarea>
      </label></td>
    </tr>
    <tr>
    <td height=”26″ align=”center”
bgcolor=”#FFFFFF”>说明简要介绍:</td>
    <td bgcolor=”#FFFFFF”><label>
      <textarea name=”body” cols=”80″ rows=”8″></textarea>
    </label></td>
  </tr>
  <tr>
    <td height=”26″ align=”center”
bgcolor=”#FFFFFF”> </td>
    <td bgcolor=”#FFFFFF”><label>
      <input type=”submit” name=”Submit” value=”保存数据” />
    </label></td>
  </tr>
  </form>
</table>
<?php
if( $_POST )
{
 
 mysql_connect(‘localhost’,’root’,’root’);
 mysql_select_db(‘fangke_cc’);
 mysql_query(“set names ‘gbk'”);
 

',$content); 
$contentQuestion=$arr[1]; 
$arr=explode('

//获取首要词$inarr =
array(卡塔尔;preg_match(/meta[s]+name=[‘]keywords[‘]
content=[‘](.*)[‘]/isU,$body,$inarr);if(isset($inarr[1])){$redatas[‘keywords’]
= cn_substr(html2text($inarr[1]),30);}

 $title =
htmlspecialchars(isset($_POST[‘title’])?$_POST[‘title’]:”);
 $keyword =
htmlspecialchars(isset($_POST[‘keyword’])?$_POST[‘keyword’]:”);
 $desc =
htmlspecialchars(isset($_POST[‘desc’])?$_POST[‘desc’]:”);
 $body =
htmlspecialchars(isset($_POST[‘body’])?$_POST[‘body’]:”);
 
 
 if( $title == “”  || strlen( $title ) > 200 )
 {
  exit(‘<script>alert(“标题非法,重新输入新闻”卡塔尔;history.back(State of Qatar;</script>’State of Qatar;
 }
 else if( $body == “” || strlen( $body ) >2048 )
 {
  exit(‘<script>alert(“内空太长,重新输入音讯”State of Qatar;history.back(卡塔尔;</script>’卡塔尔(قطر‎;
 }
 else
 {
  $time = time();
  $body=preg_replace(“/$title/”,”<h1>”.$title.”</h1>”,$body,1);
  $sql = “insert into su_zt(title,description,keyword,body,datetimes)
values(‘$title’,’$desc’,’$keyword’,’$body’,’$time’)”;
  mysql_query( $sql ) or die(mysql_error().$sql);
  die(‘<script>alert(“保存成功”卡塔尔国;location=”‘.$_SERVER[‘HTTP_REFERER’].'”;</script>’);
 }
}
?>

‘,$contentQuestion);
$contentQuestion=$arr[0];
echo “初阶搜聚内容
“;
echo “$art_title
“;
@preg_match_all(‘/(|)

//获取摘要$inarr =
array(State of Qatar;preg_match(/meta[s]+name=[‘]description[‘]
content=[‘](.*)[‘]/isU,$body,$inarr);if(isset($inarr[1])){$redatas[‘description’]
= cn_substr(html2text($inarr[1]),$cfg_auot_description);}

su_zt表结构

(.*)(|)/iUs',$content,$answerArr); 
$answerArr=$answerArr[2]; 
if($arr_order==1)//随机排序 
{ 
shuffle($answerArr); 
} 
if($arr_order==2)//倒序 
{ 
$answerArr=krsort($answerArr);//倒序 
} 
foreach($answerArr as $t) 
{ 
$answerTemp=str_replace('','',$t); 
$answerTemp=str_replace('

//获取内容if($s!=” $e!=”){$redatas[‘body’] =
GetHtmlAreaA($s,$e,$body);if($redatas[‘body’]!=”
$redatas[‘description’]==”){$redatas[‘description’] =
cn_substr(html2text($redatas[‘body’]),$GLOBALS[‘cfg_auot_description’]);}}}return
$redatas;

CREATE TABLE IF NOT EXISTS `su_zt` (
  `id` int(8) NOT NULL auto_increment,
  `title` varchar(200) character set gb2312 default NULL,
  `keyword` varchar(60) character set gb2312 default NULL,
  `description` text character set gb2312,
  `body` text character set gb2312,
  `datetimes` int(4) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
</body>
</html>
本站原创教程,转发申明来源

‘,”,$answerTemp);
$answerTemp=str_replace(‘

','',$answerTemp); 
$answerTemp=str_replace('

‘,”,$answerTemp);
if(strlen($answerTemp)>$min_t1)
{
$art_content .=$answerTemp.”
“;
}
}
//去除链接
$s1=”/()(.*)/iUs”;
$art_content=preg_replace($s1,${2},trim($art_content));
$art_content=str_replace(“nr”,”
“,$art_content);
if(strlen($art_content)>$min_t2)
{
$title_ct=mysql_query(“select count(*) from
{$table_prefix}c_article where art_title =’$art_title’
“卡塔尔国;//查看标题是或不是再次
$title_ct=@mysql_fetch_array($title_ct);
$title_ct=$title_ct[0];
if($title_ct>0)
{
$art_title .=”{$same_title}{$title_ct}”;
}
$art_time=date(“Y-m-d”);
$art_content=strtr($art_content,$keyword);
$sql=”insert into
{$table_prefix}c_article(art_title,art_content,art_time,art_author,suid)
values(‘$art_title’,’$art_content’,’$art_time’,’$art_author’,’$suid’卡塔尔国”;//插入采撷表
mysql_query($sql);
if(empty($t_catx_idState of Qatar卡塔尔国//假使无分类
{
$sql2=”insert into
{$t_table}({$t_art_title},{$t_art_content},{$t_art_time},{$t_artx_author})
values(‘$art_title’,’$art_content’,’$art_time’,’$art_author’)”;
}else
{
$sql2=”insert into
{$t_table}({$t_art_title},{$t_art_content},{$t_art_time},{$t_artx_author},{$t_catx_id})
values(‘$art_title’,’$art_content’,’$art_time’,’$art_author’,’$cat_id’)”;
}
mysql_query($sql2卡塔尔(قطر‎;//插入文章表
$jl++;
//数据库管理实现
}else
{
echo “内容长度远远不足”;
}
//获取小说内容甘休
}else
{
echo “主旨不相符须要”;
}
}else
{
echo “已经存在”;
}$rs++;
file_put_contents(“bd.txt”,”采集{$searchStr}到第{$page}第{$rs}条”);
echo “

“;
exit();
}
?>

荐礼啦明白问问搜罗插件

征集设置
卸载搜聚 翻开垦集记录 征集扶植
明亮收集
 咨询搜聚

<>

叩问收集代码:
复制代码 代码如下:

session_start();
header(“content-type:text/html;charset=utf-8”);
require(“stole_config.php”);
require(“conn.php”);
require(“keyword.php”);
if(!empty($_POST[‘ask’]))
{
$ask=urlencode(trim($_POST[‘ask’]State of Qatar卡塔尔(قطر‎;//获取表单提交的难题
$sp=”S”.$ask;
}else
{
$sp=urlencode($_GET[‘sp’]);
}
if(empty($_GET[‘jl’]))
{
$_GET[‘jl’]=1;
}
$jl=$_GET[‘jl’];
$pg=intval($_GET[‘pg’]State of Qatar;//获取页数
$rs=intval($_GET[‘rs’]卡塔尔;//得到 记录的参数
if($rs>9)
{
$rs=0;
$pg++;
}
if($pg>51)
{
echo “收集合束! 总共采撷 “.urldecode($spState of Qatar.” “.$jl.”条记下”;
exit();
}
if($sp卡塔尔(قطر‎//有设定答案才起来
{
$str=@file_get_contents(“”);
@preg_match(“/

发表评论

电子邮件地址不会被公开。 必填项已用*标注