導航:首頁 > 編程語言 > 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怎麼做 瀏覽:162
android文件夾不能用了 瀏覽:857
加密軟體的日誌 瀏覽:892
腎病pdf 瀏覽:230
網站怎麼用本地伺服器 瀏覽:120
javadoc導入android 瀏覽:517
文件掃描成pdf 瀏覽:696
涼山火災救援命令 瀏覽:54
壓縮機三相檢測 瀏覽:861
linux怎麼安裝光碟 瀏覽:799
寬頻伺服器無響應是為什麼 瀏覽:226
壓縮包內看圖 瀏覽:914
安卓手機如何發現app後台調用情況 瀏覽:561
程序員簡歷工作描述 瀏覽:159
伺服器中強制疾跑的指令是什麼 瀏覽:54
日語命令性 瀏覽:261
免費的程序編譯游戲 瀏覽:892
如何安裝屏蔽的APP 瀏覽:198
豬臉識別app如何下載 瀏覽:156
卓嵐串口伺服器如何使用 瀏覽:440