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('/([\d.]+)<\/strong>/', $response->getBody(), $matches)) { // return $matches[1]; //} else { // return null; //} } print get_tor_ip();