PHP code example of wyrihaximus / react-guzzle-psr7
1. Go to this page and download the library: Download wyrihaximus/react-guzzle-psr7 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wyrihaximus / react-guzzle-psr7 example snippets
= \React\EventLoop\Factory::create();
$handler = new \WyriHaximus\React\GuzzlePsr7\HttpClientAdapter($loop);
$client = new \GuzzleHttp\Client([
'handler' => \GuzzleHttp\HandlerStack::create($handler),
]);
$client->getAsync('http://github.com/')->then(function ($response) {
var_export($response);
var_export((string) $response->getBody());
});
$client->getAsync('http://php.net/')->then(function ($response) {
var_export($response);
var_export((string) $response->getBody());
});
$loop->run();
= \React\EventLoop\Factory::create();
$handler = new \WyriHaximus\React\GuzzlePsr7\HttpClientAdapter($loop);
$client = new \GuzzleHttp\Client([
'handler' => \GuzzleHttp\HandlerStack::create($handler),
]);
var_export((string) $client->get('http://github.com/')->getBody());