PHP code example of mix / guzzle-hook
1. Go to this page and download the library: Download mix/guzzle-hook 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/ */
mix / guzzle-hook example snippets
$client = new \GuzzleHttp\Client();
$response = $client->get('https://www.baidu.com/');
$handler = new \Mix\Guzzle\Handler\StreamHandler();
$stack = \GuzzleHttp\HandlerStack::create($handler);
$client = new \GuzzleHttp\Client([
'handler' => $stack,
]);
use GuzzleHttp\Ring\Client\StreamHandler;
use Elasticsearch\ClientBuilder;
$handler = new StreamHandler();
$builder = ClientBuilder::create();
$builder->setHosts(['127.0.0.1:9200']);
$builder->setHandler($handler);
$client = $builder->build();