导航:首页 > 编程语言 > php判断是否蜘蛛

php判断是否蜘蛛

发布时间:2024-07-15 15:36:11

php判断普通用户或蜘蛛,调用不同代码

定义一个函数 get_naps_bot()
如果是 BOT 则返回字符串, 如果不是 BOT 返回 false

function get_naps_bot()
{
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'googlebot') !== false){
return 'Googlebot';
}

if (strpos($useragent, 'msnbot') !== false){
return 'MSNbot';
}

if (strpos($useragent, 'slurp') !== false){
return 'Yahoobot';
}

if (strpos($useragent, 'spider') !== false){
return 'Baispider';
}

if (strpos($useragent, 'sohu-search') !== false){
return 'Sohubot';
}

if (strpos($useragent, 'lycos') !== false){
return 'Lycos';
}

if (strpos($useragent, 'robozilla') !== false){
return 'Robozilla';
}
return false;
}

$botName = get_naps_bot();
if( empty($botName ) )
{
include( "11.php" );// 用户访问
}
else
{
include( "22.php" ); // 蜘蛛访问
}

⑵ php搜索引擎蜘蛛程序

推荐一个国外知名度颇高的搜索引擎,含有网页蜘蛛程序,以前好象有人想要这方面的资料,现在有了,大家可以研究下源码

官方网站:
http://phpdig.toiletoine.net/

演示:
http://phpdig.toiletoine.net/sea ... te=100&option=start

中文版本和演示,我以前提供过(1.62版本的汉化),2003年11月换空间的时候没备份,没了。找下载了的人看看有没有。

下载:
这是最近(2003年12月)更新的版本的下载(1.65 En):
http://www.phpdig.net/navigation.php?action=download

演示:
http://www.phpdig.net/navigation.php?action=demo

主要功能:
类似google、网络的搜索引擎,php+mysql。

PhpDig is a http spider/search engine written in Php with a MySql database in backend.

HTTP Spidering : PhpDig follows links as it was any web browser within a web server, to build the pages list to index. Links can be in AreaMap, or frames. PhpDig supports relocations. Any syntax of HREF attribute is followed by Phpdig.
PhpDig don't go out the root site you define for the indexing. Spidering depth is choosen by user.
All html content is listed, both static and dynamic pages. PhpDig searches the Mime-Type of the document, or tests existence of an tag at the beginning of it.

支持全文搜索
Full Text indexing : PhpDig indexes all words of a document, excepting small words (less than 3 letters) an common words, those are definded in a text file.
Lone numbers are not inded, but those included in words. Underscores make part of a word.
Occurences of a word in a document is saved. Words in the title can have a more important weight in ranking results.

支持多种格式文件的索引,如pdf
File types wich can be indexed : PhpDig indexes HTML and text files by itself.
PhpDig could index PDF, MS-Word and MS-Excel files if you install external binaries on the spidering machines to this purpose.
To demonstrate the feature, you can search into Hamlet (tragedy, William Shakespeare) in MS-Word format, and L'Avare (comedy, Molière) in Pdf format.

支持robots
Other features : PhpDig Tries to read a robots.txt file at the server root. It searches meta robots tags too.
The Last-Modified header value is stored in the database to avoid rendant indexing. Also the meta revisit-after tag.

可针对特定网站进行全文索引,蜘蛛可1-9个层自动获取全部url

其中的蜘蛛程序写得十分好,有兴趣的朋友推荐研究下。

希望对你有用!

⑶ 超简单php判断是否为搜索引擎蜘蛛

得到访问ip,然后和你的收集的蜘蛛 ip 数组比对,是就 echo true,不是 echo false,够简单的吧

阅读全文

与php判断是否蜘蛛相关的资料

热点内容
华为手表运动健康app怎么弄 浏览:1000
ftp文件夹形式 浏览:666
房本抵押银行没有解压 浏览:535
用纸做解压魔术 浏览:484
服务器中运行的脚本如何测试 浏览:373
手机主题包时钟文件夹 浏览:423
怎么在app上退订短号业务 浏览:978
解压迫及法老 浏览:58
pdf横竖 浏览:137
5800计算机程序和编程 浏览:29
网上报修php源码 浏览:897
魔兽宏命令老是语言提示 浏览:971
办公文件夹大全 浏览:471
单片机闪烁灯虚拟线路图 浏览:72
App显示别的国家怎么更改 浏览:154
幻塔官方服务器叫什么 浏览:196
android自定义进度框 浏览:506
linux自动联网 浏览:492
keil编写的程序怎么不能编译呢 浏览:562
ipadair2能编程吗 浏览:358