request('GET', 'https://api.github.com/repos/guzzle/guzzle'); } catch (GuzzleException $e) { echo $e->getMessage(); return; } echo $response->getStatusCode() . PHP_EOL; echo $response->getHeaderLine('content-type') . PHP_EOL; echo $response->getBody() . PHP_EOL; // asynchronous $request = new Request('GET', 'https://httpbin.org'); $promise = $client ->sendAsync($request) ->then(function ($response) { echo 'I completed! ' . $response->getBody(); }); echo "before waiting for response" . PHP_EOL; $promise->wait(); echo "after waiting for response" . PHP_EOL;