PHP code example of profburial / tordetect
1. Go to this page and download the library: Download profburial/tordetect 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/ */
profburial / tordetect example snippets
// Get a list of Tor exit nodes
$ips = (new ProfBurial\TorDetect\Client(
__DIR__."/_data/torexitnodes.json", // File for storing ips
24 // Update every 24 hours
))->get();
// array(1067) {
// [0]=>
// string(13) "1.169.207.157"
// [1]=>
// string(12) "2.107.22.186"
// [2]=>
// string(11) "2.111.64.26"
// [3]=>
// string(11) "2.221.39.34"
// ...
// }
// Check an ip address against your list of exit nodes
$check = (new ProfBurial\TorDetect\Client(
__DIR__."/_data/torexitnodes.json", // File for storing ips
24 // Update every 24 hours
))->check('127.0.0.1');
// bool(false) if not found
// '127.0.0.1' if found
phpunit tests/ClientUnitTest.php
phpunit tests/ClientIntegrationTest.php