Hi,
I am wondering how I can catch this error when making a remote get request.
My code currently looks like this:
// Maps.co
$route = 'https://geocode.maps.co/search?q=' . $address;
// Try request
try {
$request = Remote::get($route);
} catch (Exception $error) {
$errors = $error;
}
// If success
if ($request->code() == 200) {
// Done something
}
However, my code will sometimes still throw this error in the debugger:
Could not resolve host: geocode.maps.co
I seems like the error is not getting caught in the catch.
Any clues as to what I’m doing wrong?