搜索引擎spider整理
來源:程序員人生 發(fā)布時間:2013-11-28 15:17:37 閱讀次數(shù):2879次
百度 百度的spider的user agent都會包含 Baiduspider 字符串。
相關(guān)資料:http://www.baidu.com/search/spider.htm
google google的spider的user agent都會包含 Googlebot 字符串。
相關(guān)資料:http://www.google.com/bot.html
soso soso的spider的user agent都會包含 Sosospider 字符串
相關(guān)資料:http://help.soso.com/webspider.htm
sogou
sogou的spider的user agent都會包含 Sogou web spider 字符串
相關(guān)資料:http://www.sogou.com/docs/help/webmasters.htm#07
其他的也都差不多。。。可以自行查看下網(wǎng)站的access log。
如何通過php程序控制 spider 的行為?
通過 $_SERVER["HTTP_USER_AGENT"] 獲取來訪者的 user agent,然后判斷是否含有相應(yīng)的搜索引擎spider的特定字符串,再采取后續(xù)動作就可以了。
<?php $user_agent = $_SERVER["HTTP_USER_AGENT"];
if ( eregi("Googlebot",$user_agent) ) { // is google's spider access, you can do something for it~ } ?> |
生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈