5
Guzzle例外を処理し、HTTP本文を取得する
サーバーが4xxおよび5xxステータスコードを返すときに、Guzzleからのエラーを処理したいと思います。私はこのようなリクエストをします: $client = $this->getGuzzleClient(); $request = $client->post($url, $headers, $value); try { $response = $request->send(); return $response->getBody(); } catch (\Exception $e) { // How can I get the response body? } $e->getMessageコード情報を返しますが、HTTP応答の本文は返しません。応答本文を取得するにはどうすればよいですか?