端口80或443上的TOR网络 - 共享服务器上的TOR

时间:2013-02-23 01:32:17

标签: php curl port tor screen-scraping

我想从TOR网络后面的共享服务器(只有端口80和443打开)中使用PHP cURL进行屏蔽。我尝试下面的代码并从我的服务器获取“拒绝访问”错误,因为端口8118和9050已关闭。我联系了支持,他们说这是不可能的。我怀疑它,但永远搜索,找不到一个简单的解决方案。有什么想法吗?

     <?php
$fh = fopen('curldebug.txt','w') or die($php_errormsg);
// Initialize cURL
$ch = curl_init();

// Set the website you would like to scrape
curl_setopt($ch, CURLOPT_URL, "http://www.fixitts.com/whatismyip.php");
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:18.0) Gecko/20100101 Firefox/18.0');
curl_setopt($ch, CURLOPT_REFERER, 'http://www.fixitts.com');
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8118');

curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $fh);
 // Set cURL to return the results into a PHP variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// This executes the cURL request and places the results into a variable.
$curlResults= curl_exec($ch);

        if(curl_errno($ch))
        {
            echo 'Curl error: ' . curl_error($ch);
        }

        $info = curl_getinfo($ch);
        print_r ($info);

// Close curl
curl_close($ch);
fclose($fh) or die($php_errormsg);
// Echo the results to the screen>
echo $curlResults;

?>

2 个答案:

答案 0 :(得分:4)

您的网络托管服务商的支持可能是正确的。

作为旁注,通过TOR进行屏幕抓取是一件令人难以置信的反社会事情。这是许多网站阻止从已知TOR出口节点进行访问的主要原因。请停止。

答案 1 :(得分:0)

我假设您有一个本地代理监听8118(Polipo或Privoxy)。

端口8118和9050是默认情况下TOR和Polipo在localhost(127.0.0.1)上使用的。
localhost端口不会被共享服务器阻止 - 127.0.0.1是您的PC。 如果它们被阻止,你的PC(防火墙)就会有这样的东西。

此外,您可以告诉TOR和Polipo(或其他)在其配置文件中使用不同的端口。将8118更改为上面代码中的其他内容,以及Polipo / Privoxy。

如果共享服务器被限制为80和443并不重要。这就是所有TOR需要发送你的东西。 TOR出口服务器解开它获得的任何内容并查看它应该到达的端口(原始目标端口)。

共享服务器可能阻止到已知TOR服务器的端口80和443连接。打开浏览器,将代理设置为SOCKS127.0.0.1端口9050,然后查看是否可以浏览Web。如果这不起作用,你可能有答案。您可以查看TOR文档。我记得他们告诉你如何判断TOR是否被封锁。

相关问题