PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Enrico Sola   PHP Detect Tor IP   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Detect Tor IP
Detect if the current request uses the Tor network
Author: By
Last change:
Date: 4 years ago
Size: 556 bytes


Class file image Download
require dirname(__FILE__) . '/php-tor-detector.php';

$address = '';

//Set the list path.
PHPTorDetector\PHPTorDetector::setListPath(dirname(__FILE__) . '/nodes.txt');

//Update the content fo the list (or create the list if the file doesn't exist or is empty).

//Check if this IP address is a Tor exit point.
$result = PHPTorDetector\PHPTorDetector::isTor($address);
'Is this client (' . $address . ') part of the Tor network? ' . ( $result === true ? 'Yes' : 'No' ) . '.' . PHP_EOL;