guzzle post error code example
Example: guzzle catch exceptions
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ConnectException;
$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 error\n";
die;
}
catch (RequestException $e) {
echo "Request Exception\n";
die;
}
// deal with your $reponse here