PHP code example of dunglas / php-torcontrol
1. Go to this page and download the library: Download dunglas/php-torcontrol 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/ */
dunglas / php-torcontrol example snippets
// Autoloading using composer
password authentication
$tc = new TorControl\TorControl(
array(
'hostname' => 'localhost',
'port' => 9051,
'password' => 'MySecr3tPassw0rd',
'authmethod' => 1
)
);
$tc->connect();
$tc->authenticate();
// Renew identity
$res = $tc->executeCommand('SIGNAL NEWNYM');
// Echo the server reply code and message
echo $res[0]['code'].': '.$res[0]['message'];
// Quit
$tc->quit();