nikserg / yii2-curl-tor
Support TOR proxy in Curl
Requires
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:
- On
/etc/torrc
uncomment:
#ControlPort 9051
#HashedControlPassword 16:872860B76453A77D60CA2BB8C1A7042072093276A3D701AD684053EC4C
-
Generate password with command
tor --hash-password mypass
, wheremypass
is desired password -
Insert result into line
#HashedControlPassword
-
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.