Skip to content

Commit dbfa25a

Browse files
committed
Update quickstart example
1 parent 623f532 commit dbfa25a

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ connections in a non-blocking fashion.
99
The SOCKS protocol family can be used to easily tunnel TCP connections independent
1010
of the actual application level protocol, such as HTTP, SMTP, IMAP, Telnet, etc.
1111

12-
## Quickstart examples
12+
## Quickstart example
1313

14-
Once [installed](#install), initialize a connection to a remote SOCKS proxy server:
15-
16-
```PHP
17-
<?php
18-
include_once __DIR__.'/vendor/autoload.php';
14+
Once [installed](#install), you can use the following code to create a connection
15+
to google.com via a local SOCKS proxy server:
1916

17+
```php
2018
$loop = React\EventLoop\Factory::create();
19+
$client = new Client('127.0.0.1:9050', $loop);
2120

22-
// create SOCKS client which communicates with SOCKS server 127.0.0.1:9050
23-
$client = new Clue\React\Socks\Client('127.0.0.1:9050', $loop);
24-
25-
// now work with your $client, see below
21+
$client->getConnection('www.google.com:80')->then(function ($stream) {
22+
$stream->write("GET / HTTP/1.0\r\n\r\n");
23+
});
2624

2725
$loop->run();
2826
```
2927

28+
See also the [examples](examples).
29+
3030
### Tunnelled TCP connections
3131

3232
The `Client` uses a [Promise](https://github.com/reactphp/promise)-based interface which makes working with asynchronous functions a breeze.

0 commit comments

Comments
 (0)