How to publish Gzzle 6 Async data

I am trying to send data as Async using Guzzle 6 (latest version)

    $client = new Client();
    $request = $client->postAsync($url, [
        'json' => [
                'company_name' => 'update Name'
        ],
    ]);

but i don't get any Guzzle request form like message on terminal

+4
source share
2 answers

Have you tried to send a request?

http://guzzle.readthedocs.org/en/latest/index.html?highlight=async

$client = new Client();
$request = new Request('POST', $url, [
    "json" => [
        'company_name' => 'update Name']
    ]);

$promise = $client->sendAsync($request)->then(function ($response) {
    echo 'I completed! ' . $response->getBody();
});
$promise->wait();
+1
source

Most likely you will need to call wait();

$request->wait();

0
source

All Articles