So below share a PHP write to get each search Spider crawl record code
Support Search engine as follows
Can record the Baidu,google,bing,yahoo,soso,sogou,yodao crawl website record!
The PHP code is as follows
Copy Code code as follows:
<?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 to ' 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 _thispage\n");
Fclose ($data);
}
Http://www.jb51.net Collection and Finishing
?>