Skip to content

A CodeBlog CrawlerDetect class is easy and quick to use. Detecting bots/crawlers/spiders via the user agent

License

Notifications You must be signed in to change notification settings

whallysson/crawlerdetect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crawler Detect

Maintainer Source Code PHP from Packagist Latest Version Software License Build Quality Score Total Downloads

CrawlerDetect is a PHP class for detecting bots / crawlers / spiders through the user agent and http header. Currently capable of detecting thousands of bots.

O CrawlerDetect é uma classe PHP para detectar bots/crawlers/spiders através do agente do usuário e cabeçalho http. Atualmente capaz de detectar milhares de bots.

Highlights

  • Simple installation (Instalação simples)
  • Check the user agent of the current 'visitor' (Verifique o agente do usuário do 'visitante' atual)
  • Pass a user agent as a string (Passar um agente do usuário como uma string)
  • Output the name of the bot that matched if any (Emita o nome do bot que combinou se hover)

Installation

CrawlerDetect is available via Composer:

"codeblog/crawlerdetect": "^1.0"

or run

composer require codeblog/crawlerdetect

Documentation

For details on how to use, see a sample folder in the component directory. In it you will have an example of use for each class. It works like this:

Para mais detalhes sobre como usar, veja uma pasta de exemplo no diretório do componente. Nela terá um exemplo de uso para cada classe. Ele funciona assim:

Usage:

<?php

require __DIR__ . '/../vendor/autoload.php';

use CodeBlog\CrawlerDetect\CrawlerDetect;

$CrawlerDetect = new CrawlerDetect;

// Check the user agent of the current 'visitor'
if($CrawlerDetect->isCrawler()) {
    // true if crawler user agent detected
}

// Pass a user agent as a string
if($CrawlerDetect->isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)')) {
    // true if crawler user agent detected
}

// Output the name of the bot that matched (if any)
echo $CrawlerDetect->getMatches();

Contributing

Please see CONTRIBUTING for details.

Support

Security: If you discover any security related issues, please email whallyssonallain@gmail.com instead of using the issue tracker.

Se você descobrir algum problema relacionado à segurança, envie um e-mail para whallyssonallain@gmail.com em vez de usar o rastreador de problemas.

Thank you

Credits

License

The MIT License (MIT). Please see License File for more information.

About

A CodeBlog CrawlerDetect class is easy and quick to use. Detecting bots/crawlers/spiders via the user agent

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages