Skip to content

Commit

Permalink
Update to reactphp/http v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonFrings committed Aug 6, 2020
1 parent 2404c69 commit a5a84ba
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a5a84ba

Please sign in to comment.