解决方法
try {
$response = $this->httpClient->request('POST', $request_url, [
'form_params' => $form,
]);
$body = $response->getBody()->getContents();
} catch (ServerException $e) {
$_error_code = $e->getCode();
$_error_message = $e->getResponse()->getBody()->getContents();
} catch (ClientException $e) {
$_error_code = $e->getCode();
$_error_message = $e->getResponse()->getBody()->getContents();
} catch (RequestException $e) {
$_error_code = $e->getCode();
$_error_message = $e->getResponse()->getBody()->getContents();
}
发表评论 取消回复