ghopper/curl_over_tor

CURL的包装器,使用TOR服务器作为SOCKS5代理。

v0.0.3 2017-04-22 19:21 UTC

This package is not auto-updated.

Last update: 2024-09-29 02:03:44 UTC


README

CURL的包装器,使用TOR服务器作为SOCKS5代理。使用这种软件架构,我们可以向主机发送大量请求并避免阻塞。

配置

您只需要代理主机、代理端口和代理控制端口密码。

$proxy = [
    ['port' => 9050, 'cport' => 9051],
    ['port' => 9060, 'cport' => 9061],
    ['port' => 9070, 'cport' => 9071],
    ['port' => 9080, 'cport' => 9081]
];
$curtor = new CurlOverTor('127.0.0.1', $proxy, '1234');

我建议至少使用3个代理端口以获得更好的性能。只有一个端口时,我们花费大量时间进行连接设置,而使用多个端口时,我们只需将当前连接切换到另一个已准备就绪的数据传输连接。

查看example文件夹以获取更多信息。

可用方法

  • setMaxQueryCount($count=10);
  • setopt($opt,$val);
  • exec($url=NULL);

要求

  • TOR服务器
  • php_curl扩展