diff --git a/README.md b/README.md index c990f5e..33dfbc0 100644 --- a/README.md +++ b/README.md @@ -203,12 +203,28 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (ConnectionI #### HTTP requests -HTTP operates on a higher layer than this low-level HTTP CONNECT implementation. -If you want to issue HTTP requests, you can add a dependency for -[clue/reactphp-buzz](https://github.com/clue/reactphp-buzz). -It can interact with this library by issuing all -[HTTP requests through a HTTP CONNECT proxy server](https://github.com/clue/reactphp-buzz#http-proxy). -This works for both plain HTTP and TLS-encrypted HTTPS requests. +This library also allows you to send HTTP requests through an HTTP CONNECT proxy server. + +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). This allows you to send both plain HTTP and TLS-encrypted HTTPS requests like this: + +```php +$proxy = new Clue\React\HttpProxy\ProxyConnector( + 'http://127.0.0.1:8080', + new React\Socket\Connector($loop) +); + +$connector = new React\Socket\Connector($loop, array( + 'tcp' => $proxy, + 'dns' => false +)); + +$browser = new React\Http\Browser($loop, $connector); + +$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) { + var_dump($response->getHeaders(), (string) $response->getBody()); +}); +``` +See also [ReactPHP's HTTP client](https://github.com/reactphp/http#client-usage) for more details. #### Connection timeout