Skip to content

Commit ea028b2

Browse files
committed
Update to reactphp/http v1.0.0
1 parent 0dbab58 commit ea028b2

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,25 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (ConnectionI
315315

316316
### HTTP requests
317317

318-
HTTP operates on a higher layer than this low-level SSH proxy implementation.
319-
If you want to issue HTTP requests, you can add a dependency for
320-
[clue/reactphp-buzz](https://github.com/clue/reactphp-buzz).
321-
It can interact with this library by issuing all
322-
[HTTP requests through an SSH proxy server](https://github.com/clue/reactphp-buzz#ssh-proxy).
323-
When using the `SshSocksConnector` (recommended), this works for both plain HTTP
324-
and TLS-encrypted HTTPS requests. When using the `SshProcessConnector`, this only
325-
works for plaintext HTTP requests.
318+
This library also allows you to send HTTP requests through an SSH proxy server (SSH tunnel).
319+
320+
In order to send HTTP requests, you first have to add a dependency for [ReactPHP's async HTTP client](https://github.com/reactphp/http#client-usage). You can then use this HTTP client in combination with the [`SshSocksConnector`](#sshsocksconnector) provided by this package. This allows you to send both plain HTTP and TLS-encrypted HTTPS requests like this:
321+
322+
```php
323+
$proxy = new Clue\React\SshProxy\SshSocksConnector('me@localhost:22', $loop);
324+
325+
$connector = new React\Socket\Connector($loop, array(
326+
'tcp' => $proxy,
327+
'dns' => false
328+
));
329+
330+
$browser = new React\Http\Browser($loop, $connector);
331+
332+
$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
333+
var_dump($response->getHeaders(), (string) $response->getBody());
334+
});
335+
```
336+
For more details look into [HTTP's Client Usage](https://github.com/reactphp/http#client-usage).
326337

327338
### Database tunnel
328339

0 commit comments

Comments
 (0)