Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Link to clue/reactphp-buzz for HTTP requests #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ existing higher-level protocol implementation.
* [ProxyConnector](#proxyconnector)
* [Plain TCP connections](#plain-tcp-connections)
* [Secure TLS connections](#secure-tls-connections)
* [HTTP requests](#http-requests)
* [Connection timeout](#connection-timeout)
* [DNS resolution](#dns-resolution)
* [Authentication](#authentication)
Expand All @@ -49,7 +50,7 @@ existing higher-level protocol implementation.
* [License](#license)
* [More](#more)

### Quickstart example
## Quickstart example

The following example code demonstrates how this library can be used to send a
secure HTTPS request to google.com through a local HTTP proxy server:
Expand Down Expand Up @@ -188,6 +189,15 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (ConnectionI
> Note how secure TLS connections are in fact entirely handled outside of
this HTTP CONNECT client implementation.

#### 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.

#### Connection timeout

By default, the `ProxyConnector` does not implement any timeouts for establishing remote
Expand Down
3 changes: 3 additions & 0 deletions examples/01-proxy-https.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// A simple example which requests https://google.com/ through an HTTP CONNECT proxy.
// The proxy can be given as first argument and defaults to localhost:8080 otherwise.
//
// For illustration purposes only. If you want to send HTTP requests in a real
// world project, take a look at https://github.com/clue/reactphp-buzz#http-proxy

use Clue\React\HttpProxy\ProxyConnector;
use React\Socket\Connector;
Expand Down
3 changes: 3 additions & 0 deletions examples/02-optional-proxy-https.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// This example highlights how changing from direct connection to using a proxy
// actually adds very little complexity and does not mess with your actual
// network protocol otherwise.
//
// For illustration purposes only. If you want to send HTTP requests in a real
// world project, take a look at https://github.com/clue/reactphp-buzz#http-proxy

use Clue\React\HttpProxy\ProxyConnector;
use React\Socket\Connector;
Expand Down