codeblog / crawlerdetect
CodeBlog CrawlerDetect 类使用简单快捷。通过用户代理检测机器人/爬虫/蜘蛛!
v1.0.0
2019-03-27 14:56 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-09-25 07:53:30 UTC
README
CrawlerDetect 是一个用于通过用户代理和 HTTP 头部检测机器人/爬虫/蜘蛛的 PHP 类。目前能够检测数千个机器人。
CrawlerDetect 是一个用于通过用户代理和 HTTP 头部检测机器人/爬虫/蜘蛛的 PHP 类。目前能够检测数千个机器人。
亮点
- 简单安装
- 检查当前 '访问者' 的用户代理
- 以字符串形式传递用户代理
- 如果有匹配的机器人,输出其名称
安装
CrawlerDetect 通过 Composer 提供
"codeblog/crawlerdetect": "^1.0"
或者运行
composer require codeblog/crawlerdetect
文档
有关使用方法的详细信息,请查看组件目录中的示例文件夹。其中包含了每个类的使用示例。它的工作方式如下
有关使用方法的详细信息,请查看组件目录中的示例文件夹。其中包含了每个类的使用示例。它的工作方式如下
使用方法
<?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
支持
安全:如果您发现任何与安全相关的问题,请通过电子邮件 whallyssonallain@gmail.com 反馈,而不是使用问题跟踪器。
如果您发现任何与安全相关的问题,请通过电子邮件 whallyssonallain@gmail.com 反馈,而不是使用问题跟踪器。
谢谢
致谢
- Whallysson Avelino(开发者)
- CodBlog(团队)
- 所有贡献者(支持者)
许可
MIT 许可证(MIT)。有关更多信息,请参阅 许可文件