1

Вот рабочий скрипт пинга карты сайта.

В файле sitemap.txt лежат urls карт сайта:

mydomeina.com/sitemap1.xml
mydomeina.com/sitemap2.xml
mydomeina.com/sitemap3.xml

$search_engines = array(
'Google.com' => 'http://www.google.com/webmasters/tools/ping?sitemap='
);

$search_engine_responses = array(
'Google.com' => 'Sitemap Notification Received'
);

$sitemaps = file("sitemap.txt");

foreach($search_engines as $engine_name => $engine_url){
    echo "<p><b>$engine_name</b>";
    foreach($sitemaps as $site_name => $site_map){
        $response = file_get_contents($engine_url.$site_map);
        echo "<br>";
        if(substr_count($response, $search_engine_responses[$engine_name])){
            echo $site_name.": <span style='color: green;'>Success</span>";
        }
        else{
            echo $site_name.": <span style='color: red;'>Failure</span>";
        }
    }
    echo "</p>";
}

После запуска смотрю логи и обнаруживаю вот такой знак (__)

Example:

mydomeina.com/sitemap1.xml__

mydomeina.com/sitemap2.xml__

mydomeina.com/sitemap3.xml__

Вот кусок статистика, когда бот заходит на сайт

 Rq: /sitemap.xml__

 Br: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

То есть бот заходит уже неправильно... Значит где-то в скрипте есть ошибка... Помогите найти и исправить...

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.