Microsoft has starts to download a lot of web pages in js mode from my site. So it is participating like normal user in my stats. The number of access is about 50 unique IPs every day.
So I have modified track.php for skip this entries.
Code (PHP):####################################################################
### modifica in modo da evitare lo spam USA con referrer empty,
### tipico di IPs Microsoft bingbot e poi verifica che il nome a dominio
### finisca con search.msn.com
#file track.php
function endsWith($haystack, $needle)
{
$length = strlen($needle);
return $length === 0 ||
(substr($haystack, -$length) === $needle);
}
//file_put_contents("country.txt", date("H:i:s",$time_stamp)." * ".$ip_address." * ".$country." *".$js_referer."*\n", FILE_APPEND);
if ( $js_referer == "" && $country == "us") {
$domain_name = strtolower(trim(gethostbyaddr($ip_address)));
//file_put_contents("country.txt", $domain_name."\n", FILE_APPEND);
if (endsWith($domain_name, "search.msn.com"))
exit;
// ending with search.msn.com
//https://blogs.bing.com/webmaster/2012/08/31/how-to-verify-that-bingbot-is-bingbot/
}
################################################################################
### write the log entries ###
This code check if the referer is empty and if the IP is USA. If the answer is YES then it is likely a bot and is checked the domain name. If it ended with search.msn.com then it is bingbot. See:
https://blogs.bing.com/webmaster/2012/08/31/how-to-verify-that-bingbot-is-bingbo...