Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Created August 2, 2021 17:18
Show Gist options
  • Save jhowbhz/212bdcd6ee44a4af69578b17cfe7cede to your computer and use it in GitHub Desktop.
Save jhowbhz/212bdcd6ee44a4af69578b17cfe7cede to your computer and use it in GitHub Desktop.
get body exception request GuzzleHttp GuzzleHttp\Exception\ClientException
try {
$response = $this->client->request('GET', 'api', [
'query' => $params
]);
} catch (GuzzleHttp\Exception\ClientException $e) {
$response = $e->getResponse();
echo (string)($response->getBody());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment