PHP-Web-Stat Support Forum
https://www.php-web-statistik.de/cgi-bin/yabb/YaBB.pl
Board (English) >> English board >> BingBot problem
https://www.php-web-statistik.de/cgi-bin/yabb/YaBB.pl?num=1507106436

Beitrag begonnen von Sandro kensan am 04.10.17 um 10:40:36

Titel: BingBot problem
Beitrag von Sandro kensan am 04.10.17 um 10:40:36
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-bingbot/

PHP-Web-Stat Support Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2012. Alle Rechte vorbehalten.