1. Go to this page and download the library: Download bopoda/robots-txt-parser 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/ */
bopoda / robots-txt-parser example snippets
$parser = new RobotsTxtParser(file_get_contents('http://example.com/robots.txt'));
var_dump($parser->getRules());
$parser = new RobotsTxtParser(file_get_contents('http://example.com/robots.txt'));
$validator = new RobotsTxtValidator($parser->getRules());
$url = '/';
$userAgent = 'MyAwesomeBot';
if ($validator->isUrlAllow($url, $userAgent)) {
// Crawl the site URL and do nice stuff
}
bash
php vendor/bin/phpunit
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.