setHandler(new CurlHandler()); debug('$stack->setHandler(new CurlHandler());'); $stack->push(Middleware::tor()); debug('$stack->push(MiddleWare::tor());'); $client = new Client(['handler' => $stack]); debug('$client = new Client([\'handler\' => $stack]);'); //$response = $client->get('https://check.torproject.org/'); debug('$response = $client->get(\'http://skunksworkedp2cg.onion/sites.html\');'); $response = $client->get('http://skunksworkedp2cg.onion/sites.html'); $crawler = new Crawler(); debug('$crawler = new Crawler();'); $crawler->addHtmlContent($response->getBody()->getContents()); debug('$crawler->addHtmlContent($response->getBody()->getContents());'); $links = $crawler->filter('a'); debug('$links = $crawler->filter(\'a\');'); debug('links filtered'); $hrefs = []; foreach($links as $domElement) { $href = $domElement->getAttribute('href'); if(0 !== strlen(parse_url($href, PHP_URL_SCHEME))) { $hrefs[] = $href; } } file_put_contents('elements.json', json_encode($hrefs, JSON_PRETTY_PRINT)); //if (preg_match('/([\d.]+)<\/strong>/', $response->getBody(), $matches)) { // return $matches[1]; //} else { // return null; //} } get_tor_ip();