nikserg/yii2-curl-tor

There is no license information available for the latest version (0.0.5) of this package.

Support TOR proxy in Curl

0.0.5 2019-02-27 15:16 UTC

This package is auto-updated.

Last update: 2024-03-28 03:04:29 UTC


README

Support of TOR proxy in Curl for Yii2.

Install:

composer require nikserg/yii2-curl-tor

Usage:

$curl = new CurlTor('localhost', 9050, 9051, 'OInf80v0cc83lascm9Jf');

Where

'localhost' - host of TOR instance

9050 - client port

9051 - control port

'OInf80v0cc83lascm9Jf' - auth token

By default, TOR is disabled. CurlTor is working as regular Curl model. To enable TOR, use $curlTor->enableTor().

About control port and auth token

This stuff is needed to change TOR identity (your IP-address) on fly. To do this, use $curlTor->newIdentity(). If you're not going to use such functionality, you can ignore this. How to setup:

  1. On /etc/torrc uncomment:

#ControlPort 9051

#HashedControlPassword 16:872860B76453A77D60CA2BB8C1A7042072093276A3D701AD684053EC4C

  1. Generate password with command tor --hash-password mypass, where mypass is desired password

  2. Insert result into line #HashedControlPassword

  3. Restart TOR using sudo service tor restart

You're good to go. Now you can use

$curl->newIdentity();

And you'll get new IP in a few seconds.