|
3 | 3 | // A more advanced example which requests http://www.google.com/ through a chain of SOCKS proxy servers.
|
4 | 4 | // The proxy servers can be given as arguments.
|
5 | 5 | //
|
6 |
| -// Not already running a SOCKS proxy server? See also example #21 or try this: |
| 6 | +// Not already running a SOCKS proxy server? See also example #21 or try this: |
7 | 7 | // $ ssh -D 1080 localhost
|
8 | 8 | //
|
9 | 9 | // For illustration purposes only. If you want to send HTTP requests in a real
|
|
22 | 22 | // Alternatively, you can also hard-code this value like this:
|
23 | 23 | //$path = array('127.0.0.1:9051', '127.0.0.1:9052', '127.0.0.1:9053');
|
24 | 24 |
|
25 |
| -$loop = React\EventLoop\Factory::create(); |
26 |
| - |
27 | 25 | // set next SOCKS server chain via p1 -> p2 -> p3 -> destination
|
28 |
| -$connector = new React\Socket\Connector($loop); |
| 26 | +$connector = new React\Socket\Connector(); |
29 | 27 | foreach ($path as $proxy) {
|
30 | 28 | $connector = new Clue\React\Socks\Client($proxy, $connector);
|
31 | 29 | }
|
32 | 30 |
|
33 | 31 | // please note how the client uses p3 (not p1!), which in turn then uses the complete chain
|
34 | 32 | // this creates a TCP/IP connection to p1, which then connects to p2, then to p3, which then connects to the target
|
35 |
| -$connector = new React\Socket\Connector($loop, array( |
| 33 | +$connector = new React\Socket\Connector(null, array( |
36 | 34 | 'tcp' => $connector,
|
37 | 35 | 'timeout' => 3.0,
|
38 | 36 | 'dns' => false
|
|
49 | 47 | }, function (Exception $e) {
|
50 | 48 | echo 'Error: ' . $e->getMessage() . PHP_EOL;
|
51 | 49 | });
|
52 |
| - |
53 |
| -$loop->run(); |
0 commit comments