The code written by PHP to obtain crawling records of search spider. The following is a search engine that uses php to obtain crawling records of various search Spider. the supported search engines can record the following records: Baidu, Google, Bing, Yahoo, Soso, Sogou, and Yodao crawling websites! Php code. The following is a code written in php to obtain crawling records of search spider.
The following search engines are supported:
Record the crawling websites of Baidu, Google, Bing, Yahoo, Soso, Sogou, and Yodao!
The php code is as follows:
The code is as follows:
Function get_naps_bot ()
{
$ Useragent = strtolower ($ _ SERVER ['http _ USER_AGENT ']);
If (strpos ($ useragent, 'googlebot ')! = False ){
Return 'Google ';
}
If (strpos ($ useragent, 'baidider Ider ')! = False ){
Return 'baidu ';
}
If (strpos ($ useragent, 'msnbot ')! = False ){
Return 'bin ';
}
If (strpos ($ useragent, 'slurp ')! = False ){
Return 'Yahoo ';
}
If (strpos ($ useragent, 'sosospider ')! = False ){
Return 'sososo ';
}
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, "");
Fwrite ($ data, "Time: $ time robot: $ searchbot URL: $ tlc_thispage \ n ");
Fclose ($ data );
}
// Collect http://www.jb51.net
?>
Supports the following search engines to record the crawler website records of Baidu, Google, Bing, Yahoo, Soso, Sogou, and Yodao! Php code...