grcs/tor-bundle

v0.1 2014-11-13 11:21 UTC

This package is auto-updated.

Last update: 2024-09-29 04:48:38 UTC


README

许可

see LICENSE

安装

  1. 将 TorBundle 添加到您的 vendor/ 目录

通过 composer

"require": {
    ...
    "grcs/tor-bundle": "dev-master"
    ...
}
  1. 将 TorBundle 添加到您的应用内核

    // app/AppKernel.php

    public function registerBundles() { return array( // ... new Grcs\TorBundle\GrcsTorBundle(), // ... ); }

  2. 安装 TOR https://www.torproject.org/docs/tor-doc-unix.html.en

  3. 配置 TOR

    // 添加到 /patch/to/etc/tor/torrc

    控制端口 9051

  4. 运行 TOR

  5. 使用

    $tor = $this->get('grcs.tor'); $tor->getNewIpAddress();

    Curl: $options = array( CURLOPT_URL => 'http://google.com', CURLOPT_HEADER => false, CURLOPT_TIMEOUT => 30, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_PROXY => $tor->getTorHostname() . ':' . $tor->getTorPort(), CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, ); $ch = \curl_init(); \curl_setopt_array($ch, $options); $result = \curl_exec($ch);