response == "pong") { $result = $apiResult->response; } else { $result = $resultJSON; } } else { $result = $resultJSON; } break; case 401: $result = 'Missing or wrong API Key'; break; default: $result = 'Unhandled error: ' . $httpResponse; } } else { $result = curl_error($curl); } curl_close($curl); return $result; } }