如何检索在 Guzzle 异常时发送的表单参数?
How to Retrieve Form Parameters sent on a Guzzle Exception?
如何从 Guzzle BadResponseException (ClientException || ServerException) 对象中检索 form_params?
我在文档中找不到它。
try {
$reponse = $this->client->post($uri, [
'form_params' => $params,
'headers' => $this->getHeaders()
]);
} catch (RequestException $e){
/// get form_params here without accessing $params
}
表单编码参数可以在请求正文中找到。
try {
$reponse = $this->client->post($uri, [
'form_params' => $params,
'headers' => $this->getHeaders()
]);
} catch (RequestException $e){
echo (string) $e->getRequest()->getBody();
}
如何从 Guzzle BadResponseException (ClientException || ServerException) 对象中检索 form_params?
我在文档中找不到它。
try {
$reponse = $this->client->post($uri, [
'form_params' => $params,
'headers' => $this->getHeaders()
]);
} catch (RequestException $e){
/// get form_params here without accessing $params
}
表单编码参数可以在请求正文中找到。
try {
$reponse = $this->client->post($uri, [
'form_params' => $params,
'headers' => $this->getHeaders()
]);
} catch (RequestException $e){
echo (string) $e->getRequest()->getBody();
}