@@ -315,15 +315,37 @@ $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
318+ This library also allows you to send
319+ [ HTTP requests through an SSH proxy server] ( https://github.com/reactphp/http#ssh-proxy ) .
320+
321+ In order to send HTTP requests, you first have to add a dependency for
322+ [ ReactPHP's async HTTP client] ( https://github.com/reactphp/http#client-usage ) .
323+ This allows you to send both plain HTTP and TLS-encrypted HTTPS requests like this:
324+
325+ ``` php
326+ $proxy = new Clue\React\SshProxy\SshSocksConnector('me@localhost:22', $loop);
327+
328+ $connector = new React\Socket\Connector($loop, array(
329+ 'tcp' => $proxy,
330+ 'dns' => false
331+ ));
332+
333+ $browser = new React\Http\Browser($loop, $connector);
334+
335+ $browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
336+ var_dump($response->getHeaders(), (string) $response->getBody());
337+ }, function (Exception $e) {
338+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
339+ });
340+ ```
341+
342+ We recommend using the ` SshSocksConnector ` , this works for both plain HTTP
324343and TLS-encrypted HTTPS requests. When using the ` SshProcessConnector ` , this only
325344works for plaintext HTTP requests.
326345
346+ See also [ ReactPHP's HTTP client] ( https://github.com/reactphp/http#client-usage )
347+ and any of the [ examples] ( examples ) for more details.
348+
327349### Database tunnel
328350
329351We should now have a basic understanding of how we can tunnel any TCP/IP-based
0 commit comments