response == "pong") { $result = $apiResult->response; } else { $result = $apiResult; } } else { $result = $resultJSON; } break; case 401: $result = 'Missing or wrong API Key'; break; default: echo __FILE__, __LINE__, $resultJSON; $result = 'Unhandled error: ' . $httpResponse; } } else { $result = curl_error(handle: $curl); } curl_close(handle: $curl); return [ 'data' => $result, 'header' => $httpResponse ?? '' ]; } }