承接 ryanj93/php-tor-detector 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ryanj93/php-tor-detector

Composer 安装命令:

composer require ryanj93/php-tor-detector

包简介

A very simple library to detect Tor connections using PHP 7 without any dependency.

README 文档

README

A very simple library to detect Tor connections using PHP 7 without any dependency.

Usage

Before using the library, you have to set the path to the file that contains the list of all Tor exit points, if you don't have the list you can set an arbitrary file name instead. To set the library path, use this method:

PHPTorDetector\PHPTorDetector::setListPath('nodes.txt');

If the file doesn't exist or is empty or you just want to update its content, you can use this method to download the updated list and overwrite new list in the file:

PHPTorDetector\PHPTorDetector::updateFile();

Once you have the list, you can check if an IP address is part of the Tor network by using this method:

$result = PHPTorDetector\PHPTorDetector::isTor('IP ADDRESS HERE');

If you want to get the IP address of the client you can use this method:

$address = PHPTorDetector\PHPTorDetector::getClientIPAddress();

By default, check result is cached within session (if session is enabled and if the script is not executed in CLI), you can disable this feature by using this method:

PHPTorDetector\PHPTorDetector::setSessionCache(false);

If you want to change the index where the results will be cached you can use this method:

PHPTorDetector\PHPTorDetector::setSessionCacheName('tor_cache');

Note that if you want to set multiple indexes within the session array you can separate indexes with a "@" like this:

PHPTorDetector\PHPTorDetector::setSessionCacheName('tor@cache');

In this way, cache will be stored in $_SESSION['tor']['cache'].

Are you looking for the Node.js version? Give a look here.

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2018-02-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固