dongqidi2799 2013-02-23 01:32
浏览 140

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

I want to screen scrape using PHP cURL from a shared server (only ports 80 and 443 are open) from behind the TOR network. I try the code below and get "Access Denied" error from my server because port 8118 and 9050 are closed. I contacted support and they said it is impossible. I doubt it, but searched forever and couldn't find an easy solution. Any thoughts?

     <?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条回答 默认 最新

  • drne47241 2013-02-23 01:59
    关注

    Your web host's support is probably correct.

    As a side note, screen-scraping through TOR is an incredibly antisocial thing to do. It is a large part of the reason why many web sites block access from known TOR exit nodes. Please stop.

    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)