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

PHP写的获取各搜索蜘蛛爬行记录代码_PHP教程,第1张

那么下面分享一款用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.jb51.net.txt";

$time=nowtime();

$data=fopen($file,"a");

fwrite($data,"Time:$time robot:$searchbot URL:$tlc_thispagen");

fclose($data);

}

//http://www.jb51.net收集整理

?>

http://www.bkjia.com/PHPjc/325712.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325712.htmlTechArticle那么下面分享一款用php写的获取各搜索蜘蛛爬行记录代码 支持搜索引擎如下 可以记录Baidu,Google,Bing,Yahoo,Soso,Sogou,Yodao爬行网站的记录! php代码...

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/347752.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2018-05-31
下一篇 2018-05-31

发表评论

登录后才能评论

评论列表(0条)

保存