Iam trying to post through an api using curl... I want to handle exceptions when the site is very busy and throws us connection refused or reset error.
try {
// perform your curl here
} catch (Exception $ex) {
// here you have the exception
}
Or check your log on which specific exception is thrown when you get connection refused and put that one instead of the Exception in the catch. But Exception is the one that all extend from so that will catch all exceptions.