PHP code example of andronof / robotstxt

1. Go to this page and download the library: Download andronof/robotstxt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andronof / robotstxt example snippets


$robotstxt = new \Robotstxt(file_get_contents('http://yandex.ru/robots.txt'));

$robotstxt = new \Robotstxt();
$robotstxt->init(file_get_contents('http://yandex.ru/robots.txt'));

if ($robotstxt->isAllowed('/msearch') ) {
    echo('Доступ разрешен');
} else {
    echo('Доступ запрещен');
}