pader / amphp-guzzle-handler
使用 amphp 使 guzzle 非阻塞。
dev-main
2024-01-31 08:59 UTC
Requires
- amphp/http-client: ^5.0
- guzzlehttp/guzzle: ^6.0 || ^7.0
This package is auto-updated.
Last update: 2024-09-30 01:19:56 UTC
README
使用 amphp 使 guzzle 非阻塞。
use Amp\Http\Client\HttpClientBuilder; use AmpGuzzle\HttpClientHandler; use GuzzleHttp\Client; $httpClient = HttpClientBuilder::buildDefault(); $handler = new HttpClientHandler($httpClient); $client = new Client([ 'handler' => $handler ]); $response = $client->post('https://www.google.com/'); print_r($response->getBody()->getContents());