Ejemplo: excepciones de captura de trago
use GuzzleHttpClient;
use GuzzleHttpExceptionRequestException;
use GuzzleHttpExceptionConnectException;
$client = new Client();
try{
$response = $client->request('GET', 'http://github.com');
}
catch (ConnectException $e) {
// Connection exceptions are not caught by RequestException
echo "Internet, DNS, or other connection errorn";
die;
}
catch (RequestException $e) {
echo "Request Exceptionn";
die;
}
// deal with your $reponse here
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)