搜索蜘蛛爬行记录 PHP写的获取各搜索蜘蛛爬行记录代码

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

搜索蜘蛛爬行记录 PHP写的获取各搜索蜘蛛爬行记录代码

  2021-03-19 我要评论
想了解PHP写的获取各搜索蜘蛛爬行记录代码的相关内容吗,在本文为您仔细讲解搜索蜘蛛爬行记录的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:搜索蜘蛛,爬行记录,下面大家一起来学习吧。
那么下面分享一款用php写的获取各搜索蜘蛛爬行记录代码
支持搜索引擎如下
可以记录Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行网站的记录!
php代码如下
复制代码 代码如下:

<?php
function get_naps_bot()
{
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'googlebot') !== false){
return 'Google';
}
if (strpos($useragent, 'baiduspider') !== false){
return 'Baidu';
}
if (strpos($useragent, 'msnbot') !== false){
return 'Bing';
}
if (strpos($useragent, 'slurp') !== false){
return 'Yahoo';
}
if (strpos($useragent, 'sosospider') !== false){
return 'Soso';
}
if (strpos($useragent, 'sogou spider') !== false){
return 'Sogou';
}
if (strpos($useragent, 'yodaobot') !== false){
return 'Yodao';
}
return false;
}
function nowtime(){
$date=date("Y-m-d.G:i:s");
return $date;
}
$searchbot = get_naps_bot();
if ($searchbot) {
$tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
$url=$_SERVER['HTTP_REFERER'];
$file="www.qb5200.com.txt";
$time=nowtime();
$data=fopen($file,"a");
fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispage\n");
fclose($data);
}
////www.qb5200.com收集整理
?>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们