泛目录标题采集(PHP自动更新采集内容)

大家都知道网站需要时效性强的内容,那么泛目录更注重这点,内容时效性强且及时更新就是泛目录首先要解决的问题。今天,错误博客(cuowu.com)分享的内容为《泛目录标题采集(PHP自动更新采集内容)》。希望对大家有所帮助。

PHP自动更新采集内容
PHP自动更新采集内容

一、自动采集原理

自动采集用的是三个php文件,每个文章均放一个header(“refresh;url”),A里面放B,B里面放C,C里面放A,开始只需要运行A,那么B过一定时间就会运行一次,B运行时会运行C一次,C运行时会回到A,周而复始,这样子就可以让三个php文件24小时内自动采集了。

header(“refresh:600;url=./cuowucom_biaotiA.php”);

header(“refresh:6;url=./cuowucom_biaotiB.php”);

header(“refresh:26;url=./cuowucom_biaoti.php”);

如下图所示为采集到的标题:

泛目录标题采集
泛目录标题采集

二、PHP采集标题到txt

泛目录程序中需要调用一些时效性强的标题,采用PHP程序实现自动采集并存放到txt中,会很方便。至少比以前介绍的利用宝塔来定时访问要好很多,因为宝塔定时访问可能会增加不少问题出现概率。三个PHP采集中国新闻网的源码如下:

cuowu_biaoti.php

<?php

// + 错误博客(cuowu.com)泛目录站群程序 < 技术QQ:2216876660 >
// +—————————————————————————
// + 错误博客最新力作,轻松达到秒收录秒排名效果!
// +—————————————————————————
// + 错误博客泛目录站群适合各行业操作关键词快速排名!
// +—————————————————————————
// + 错误博客泛目录站群【不断霸气突破最新搜索引擎算法】
// +—————————————————————————
$txtnames =”cuowucom/biaoti/cuowucom-biaoti.txt”;
header(“refresh:6;url=./cuowucom_biaotiA.php”);
set_time_limit(0);
$imgline=””;
function preg_substr($start, $end, $str)
{
$temp = preg_split($start, $str);
$content = preg_split($end, $temp[1]);
return $content[0];
}
function str_substr($start, $end, $str)
{
$temp = explode($start, $str, 2);
$content = explode($end, $temp[1], 2);
return $content[0];
}
function microtime_float()
{
list($usec, $sec) = explode(” “, microtime());
return ((float)$usec + (float)$sec);
}
function getiurl($id)
{
global $imgline;
$str=$imgline[$id];
return $str;
}

$abcd=file_get_contents(“http://www.chinanews.com/theory.shtml”);
$hello = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd));

$abcd2=file_get_contents(“http://www.chinanews.com/jiankang.shtml”);
$hello2 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd2));

$abcd3=file_get_contents(“http://www.chinanews.com/scroll-news/news2.html”);
$hello3 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd3));

$abcd4=file_get_contents(“http://www.chinanews.com/society.shtml”);
$hello4 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd4));

$abcd5=file_get_contents(“http://www.chinanews.com/scroll-news/news2.html”);
$hello5 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abc5));

$abcd6=file_get_contents(“http://www.chinanews.com/jiankang.shtml”);
$hello6 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd6));

$abcd7=file_get_contents(“http://www.chinanews.com/theory.shtml”);
$hello7 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd7));

$abcd8=file_get_contents(“http://www.chinanews.com/society.shtml”);
$hello8 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd8));

$abcd9=file_get_contents(“http://www.chinanews.com/world.shtml”);
$hello9 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd9));

$abcd10=file_get_contents(“http://www.chinanews.com/scroll-news/news1.html”);
$hello10 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd10));

$abcd11=file_get_contents(“http://www.chinanews.com/scroll-news/news2.html”);
$hello11 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd11));

$abcd12=file_get_contents(“http://www.chinanews.com/scroll-news/news3.html”);
$hello12 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd12));
$abcd13=file_get_contents(“http://www.chinanews.com/scroll-news/news4.html”);
$hello13 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd13));

$myfile = fopen($txtnames, “w”) or die(“错误博客 cuowu.com 泛目录站群技术Q 2216876660 Unable to open file!”);

for($index=0;$index<count($hello)-1;$index++)
{
$hello[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello[$index]);
echo $hello[$index].”</br>”;
fwrite($myfile, $hello[$index].”
“);
}

for($index=0;$index<count($hello2)-1;$index++)
{
$hello2[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello2[$index]);
echo $hello2[$index].”</br>”;
fwrite($myfile, $hello2[$index].”
“);
}

for($index=0;$index<count($hello3)-1;$index++)
{
$hello3[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello3[$index]);
echo $hello3[$index].”</br>”;
fwrite($myfile, $hello3[$index].”
“);
}

for($index=0;$index<count($hello4)-1;$index++)
{
$hello4[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello4[$index]);
echo $hello4[$index].”</br>”;
fwrite($myfile, $hello4[$index].”
“);
}

for($index=0;$index<count($hello5)-1;$index++)
{
$hello5[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello5[$index]);
echo $hello5[$index].”</br>”;
fwrite($myfile, $hello5[$index].”
“);
}

for($index=0;$index<count($hello6)-1;$index++)
{
$hello6[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello6[$index]);
echo $hello6[$index].”</br>”;
fwrite($myfile, $hello6[$index].”
“);
}

for($index=0;$index<count($hello7)-1;$index++)
{
$hello7[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello7[$index]);
echo $hello7[$index].”</br>”;
fwrite($myfile, $hello7[$index].”
“);
}

for($index=0;$index<count($hello8)-1;$index++)
{
$hello8[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello8[$index]);
echo $hello8[$index].”</br>”;
fwrite($myfile, $hello8[$index].”
“);
}
for($index=0;$index<count($hello9)-1;$index++)
{
$hello9[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello9[$index]);
echo $hello9[$index].”</br>”;
fwrite($myfile, $hello9[$index].”
“);
}

for($index=0;$index<count($hello10)-1;$index++)
{
$hello10[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello10[$index]);
echo $hello10[$index].”</br>”;
fwrite($myfile, $hello10[$index].”
“);
}

for($index=0;$index<count($hello11)-1;$index++)
{
$hello11[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello11[$index]);
echo $hello11[$index].”</br>”;
fwrite($myfile, $hello11[$index].”
“);
}

for($index=0;$index<count($hello12)-1;$index++)
{
$hello12[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello12[$index]);
echo $hello12[$index].”</br>”;
fwrite($myfile, $hello12[$index].”
“);
}

for($index=0;$index<count($hello13)-1;$index++)
{
$hello13[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello13[$index]);
echo $hello13[$index].”</br>”;
fwrite($myfile, $hello13[$index].”
“);
}

fclose($myfile);

cuowu_biaotiA.php

<?php

// + 错误博客(cuowu.com)泛目录站群程序 < 技术QQ:2216876660 >
// +—————————————————————————
// + 错误博客最新力作,轻松达到秒收录秒排名效果!
// +—————————————————————————
// + 错误博客泛目录站群适合各行业操作关键词快速排名!
// +—————————————————————————
// + 错误博客泛目录站群【不断霸气突破最新搜索引擎算法】
// +—————————————————————————
$txtnames =”cuowucom/biaoti/cuowucom-biaotiA.txt”;
header(“refresh:6;url=./cuowucom_biaotiB.php”);
set_time_limit(0);
$imgline=””;
function preg_substr($start, $end, $str)
{
$temp = preg_split($start, $str);
$content = preg_split($end, $temp[1]);
return $content[0];
}
function str_substr($start, $end, $str)
{
$temp = explode($start, $str, 2);
$content = explode($end, $temp[1], 2);
return $content[0];
}
function microtime_float()
{
list($usec, $sec) = explode(” “, microtime());
return ((float)$usec + (float)$sec);
}
function getiurl($id)
{
global $imgline;
$str=$imgline[$id];
return $str;
}

$abcd=file_get_contents(“http://www.chinanews.com/society.shtml”);
$hello = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd));

$abcd2=file_get_contents(“http://www.chinanews.com/scroll-news/news5.html”);
$hello2 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd2));

$abcd3=file_get_contents(“http://www.chinanews.com/scroll-news/news6.html”);
$hello3 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd3));

$abcd4=file_get_contents(“http://www.chinanews.com/scroll-news/news7.html”);
$hello4 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd4));
$abcd5=file_get_contents(“http://www.chinanews.com/scroll-news/news8.html”);
$hello5 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd5));

$abcd6=file_get_contents(“http://www.chinanews.com/mil/news.shtml”);
$hello6 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd6));

$abcd7=file_get_contents(“http://www.chinanews.com/scroll-news/news5.html”);
$hello7 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd7));

$abcd8=file_get_contents(“http://www.chinanews.com/scroll-news/news6.html”);
$hello8 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd8));

$abcd9=file_get_contents(“http://www.chinanews.com/scroll-news/news7.html”);
$hello9 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd9));
$abcd10=file_get_contents(“http://www.chinanews.com/scroll-news/news2.html”);
$hello10 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd10));

$myfile = fopen($txtnames, “w”) or die(“错误博客 cuowu.com 泛目录站群技术Q 2216876660 Unable to open file!”);

for($index=0;$index<count($hello)-1;$index++)
{
$hello[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello[$index]);
echo $hello[$index].”</br>”;
fwrite($myfile, $hello[$index].”
“);
}

for($index=0;$index<count($hello2)-1;$index++)
{
$hello2[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello2[$index]);
echo $hello2[$index].”</br>”;
fwrite($myfile, $hello2[$index].”
“);
}

for($index=0;$index<count($hello3)-1;$index++)
{
$hello3[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello3[$index]);
echo $hello3[$index].”</br>”;
fwrite($myfile, $hello3[$index].”
“);
}

for($index=0;$index<count($hello4)-1;$index++)
{
$hello4[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello4[$index]);
echo $hello4[$index].”</br>”;
fwrite($myfile, $hello4[$index].”
“);
}

for($index=0;$index<count($hello5)-1;$index++)
{
$hello5[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello5[$index]);
echo $hello5[$index].”</br>”;
fwrite($myfile, $hello5[$index].”
“);
}

for($index=0;$index<count($hello6)-1;$index++)
{
$hello6[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello6[$index]);
echo $hello6[$index].”</br>”;
fwrite($myfile, $hello6[$index].”
“);
}

for($index=0;$index<count($hello7)-1;$index++)
{
$hello7[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello7[$index]);
echo $hello7[$index].”</br>”;
fwrite($myfile, $hello7[$index].”
“);
}

for($index=0;$index<count($hello8)-1;$index++)
{
$hello8[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello8[$index]);
echo $hello8[$index].”</br>”;
fwrite($myfile, $hello8[$index].”
“);
}
for($index=0;$index<count($hello9)-1;$index++)
{
$hello9[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello9[$index]);
echo $hello9[$index].”</br>”;
fwrite($myfile, $hello9[$index].”
“);
}

for($index=0;$index<count($hello10)-1;$index++)
{
$hello10[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello10[$index]);
echo $hello10[$index].”</br>”;
fwrite($myfile, $hello10[$index].”
“);
}

fclose($myfile);

cuowu_biaotiB.php

<?php

// + 错误博客(cuowu.com)泛目录站群程序 < 技术QQ:2216876660 >
// +—————————————————————————
// + 错误博客最新力作,轻松达到秒收录秒排名效果!
// +—————————————————————————
// + 错误博客泛目录站群适合各行业操作关键词快速排名!
// +—————————————————————————
// + 错误博客泛目录站群【不断霸气突破最新搜索引擎算法】
// +—————————————————————————
$txtnames =”cuowucom/biaoti/cuowucom-biaotiB.txt”;
header(“refresh:26;url=./cuowucom_biaoti.php”);
set_time_limit(0);
$imgline=””;
function preg_substr($start, $end, $str)
{
$temp = preg_split($start, $str);
$content = preg_split($end, $temp[1]);
return $content[0];
}
function str_substr($start, $end, $str)
{
$temp = explode($start, $str, 2);
$content = explode($end, $temp[1], 2);
return $content[0];
}
function microtime_float()
{
list($usec, $sec) = explode(” “, microtime());
return ((float)$usec + (float)$sec);
}
function getiurl($id)
{
global $imgline;
$str=$imgline[$id];
return $str;
}

$abcd=file_get_contents(“http://www.chinanews.com/compatriot.shtml”);
$hello = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd));

$abcd2=file_get_contents(“http://www.chinanews.com/business/gd.shtml”);
$hello2 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd2));

$abcd3=file_get_contents(“http://www.chinanews.com/taiwan.shtml”);
$hello3 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd3));

$abcd4=file_get_contents(“http://www.chinanews.com/scroll-news/news1.html”);
$hello4 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd4));
$abcd5=file_get_contents(“http://www.chinanews.com/scroll-news/news2.html”);
$hello5 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd5));

$abcd6=file_get_contents(“http://www.chinanews.com/entertainment.shtml”);
$hello6 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd6));

$abcd7=file_get_contents(“http://www.chinanews.com/ty/gun-news.html”);
$hello7 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd7));

$abcd8=file_get_contents(“http://www.chinanews.com/wenhua.shtml”);
$hello8 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd8));

$abcd9=file_get_contents(“http://www.chinanews.com/scroll-news/news1.html”);
$hello9 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd9));

$abcd10=file_get_contents(“http://www.chinanews.com/scroll-news/news2.html”);
$hello10 = explode(‘<div class=”dd_time”>’,str_substr(‘<div class=”content_list”>
‘, ‘<div id=”footerAd”>’, $abcd10));

$myfile = fopen($txtnames, “w”) or die(“错误博客 cuowu.com 泛目录站群技术Q 2216876660 Unable to open file!”);

for($index=0;$index<count($hello)-1;$index++)
{
$hello[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello[$index]);
echo $hello[$index].”</br>”;
fwrite($myfile, $hello[$index].”
“);
}

for($index=0;$index<count($hello2)-1;$index++)
{
$hello2[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello2[$index]);
echo $hello2[$index].”</br>”;
fwrite($myfile, $hello2[$index].”
“);
}

for($index=0;$index<count($hello3)-1;$index++)
{
$hello3[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello3[$index]);
echo $hello3[$index].”</br>”;
fwrite($myfile, $hello3[$index].”
“);
}

for($index=0;$index<count($hello4)-1;$index++)
{
$hello4[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello4[$index]);
echo $hello4[$index].”</br>”;
fwrite($myfile, $hello4[$index].”
“);
}

for($index=0;$index<count($hello5)-1;$index++)
{
$hello5[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello5[$index]);
echo $hello5[$index].”</br>”;
fwrite($myfile, $hello5[$index].”
“);
}

for($index=0;$index<count($hello6)-1;$index++)
{
$hello6[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello6[$index]);
echo $hello6[$index].”</br>”;
fwrite($myfile, $hello6[$index].”
“);
}

for($index=0;$index<count($hello7)-1;$index++)
{
$hello7[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello7[$index]);
echo $hello7[$index].”</br>”;
fwrite($myfile, $hello7[$index].”
“);
}

for($index=0;$index<count($hello8)-1;$index++)
{
$hello8[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello8[$index]);
echo $hello8[$index].”</br>”;
fwrite($myfile, $hello8[$index].”
“);
}
for($index=0;$index<count($hello9)-1;$index++)
{
$hello9[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello9[$index]);
echo $hello9[$index].”</br>”;
fwrite($myfile, $hello9[$index].”
“);
}

for($index=0;$index<count($hello10)-1;$index++)
{
$hello10[$index]=str_substr(‘shtml”>’, ‘</a>’, $hello10[$index]);
echo $hello10[$index].”</br>”;
fwrite($myfile, $hello10[$index].”
“);
}

fclose($myfile);

以上就是错误博客(cuowu.com)分享的内容为《泛目录标题采集(PHP自动更新采集内容)》。感谢您的阅读。

百度搜索“错误博客”即可找到本站,微信搜索“小小课堂网”关注小小课堂网公众号。错误博客( cuowu.com )欢迎用户投稿,发布者:中二少年,文章版权归作者所有,投稿文章不代表错误博客立场,中二少年发布为错误博客原创文章,转载请注明出处:https://cuowu.com/3776.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2021年7月24日 上午1:02
下一篇 2021年7月25日 上午1:00

相关推荐

发表评论

您的电子邮箱地址不会被公开。