PHP code example of wyrihaximus / react-guzzle-ring
1. Go to this page and download the library: Download wyrihaximus/react-guzzle-ring 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-ring example snippets
= \React\EventLoop\Factory::create();
$handler = new \WyriHaximus\React\RingPHP\HttpClientAdapter($loop);
$client = new \GuzzleHttp\Client([
'handler' => $handler,
]);
$client->get('http://github.com/', [ // This will redirect to https://github.com/
'future' => true,
])->then(function ($response) {
var_export($response);
var_export((string) $response->getBody());
});
$client->get('http://php.net/', [
'future' => true,
])->then(function ($response) {
var_export($response);
var_export((string) $response->getBody());
});
$loop->run();