Skip to content

Commit f8fa56f

Browse files
committed
Update to reactphp/http v1.0.0
1 parent 2404c69 commit f8fa56f

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,29 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (ConnectionI
203203

204204
#### HTTP requests
205205

206-
HTTP operates on a higher layer than this low-level HTTP CONNECT implementation.
207-
If you want to issue HTTP requests, you can add a dependency for
208-
[clue/reactphp-buzz](https://github.com/clue/reactphp-buzz).
209-
It can interact with this library by issuing all
210-
[HTTP requests through a HTTP CONNECT proxy server](https://github.com/clue/reactphp-buzz#http-proxy).
211-
This works for both plain HTTP and TLS-encrypted HTTPS requests.
206+
This library also allows you to send HTTP requests through an HTTP CONNECT proxy server.
207+
208+
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:
209+
210+
```php
211+
$proxy = new Clue\React\HttpProxy\ProxyConnector(
212+
'http://127.0.0.1:8080',
213+
new React\Socket\Connector($loop)
214+
);
215+
216+
$connector = new React\Socket\Connector($loop, array(
217+
'tcp' => $proxy,
218+
'dns' => false
219+
));
220+
221+
$browser = new React\Http\Browser($loop, $connector);
222+
223+
$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
224+
var_dump($response->getHeaders(), (string) $response->getBody());
225+
});
226+
```
227+
228+
See also [ReactPHP's HTTP client](https://github.com/reactphp/http#client-usage) for more details.
212229

213230
#### Connection timeout
214231

0 commit comments

Comments
 (0)