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
如何修改我的代碼不會崩潰我的網站,當它發生?