0
我使用请求Web服务:今天如何处理错误500当请求一个远程服务器与guzzle?
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
try {
$client = new Client();
$response = $client->request('GET', $url); //it crashes at this line
$content = json_decode($response->getBody(), true);
}
catch (ConnectException $e) {
\Drupal::logger('amu_hal')->error('incorrect_url'.$url);
}
远程服务器返回错误500
如何修改我的代码不会崩溃我的网站,当它发生?