PHP code example of macsch15 / crawler-detector
1. Go to this page and download the library: Download macsch15/crawler-detector 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/ */
macsch15 / crawler-detector example snippets
CrawlerDetector\Detector\CrawlerDetector;
CrawlerDetector::isCrawler($useragent); // returns true or false
CrawlerDetector::getCrawlerName(); // returns crawler name or null
// Example
if (CrawlerDetector::isCrawler($useragent) === true) {
return CrawlerDetector::getCrawlerName();
}