1. Go to this page and download the library: Download megahertz/guzzle-tor 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/ */
megahertz / guzzle-tor example snippets
function get_tor_ip()
{
$stack = new HandlerStack();
$stack->setHandler(new CurlHandler());
$stack->push(Middleware::tor());
$client = new Client(['handler' => $stack]);
$response = $client->get('https://check.torproject.org/');
if (preg_match('/<strong>([\d.]+)<\/strong>/', $response->getBody(), $matches)) {
return $matches[1];
} else {
return null;
}
}