tor-spider/tor.php

29 lines
742 B
PHP
Raw Normal View History

2016-12-21 12:57:48 -08:00
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleTor\Middleware;
require 'vendor/autoload.php';
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/');
$response = $client->get('http://skunksworkedp2cg.onion/sites.html');
file_put_contents('sites.html', $response->getBody()->getContents());
//if (preg_match('/<strong>([\d.]+)<\/strong>/', $response->getBody(), $matches)) {
// return $matches[1];
//} else {
// return null;
//}
}
print get_tor_ip();