= 300) { $slack = new \classes\slack(); echo 'Attempting credentials: ' . $url . ' with method: ' . $method . ' and data: ' . json_encode($data) . "\n"; echo 'Response: ' . $response . "\n"; echo 'HTTP Code: ' . $httpCode . "\n"; echo 'Headers: ' . json_encode($headers) . "\n"; $slack->send_message('Limble Request Failed: ' . $response, 'Limble Request Error'); throw new \Exception('Request failed with status code ' . $httpCode); } // Check if the response is valid JSON $responseData = json_decode($response, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new \Exception('Invalid JSON response: ' . json_last_error_msg()); } // Return the response data return $responseData; } /** * @inheritDoc */ public function generateBasicAuthHeader(string $client_id, string $client_secret): string { // Generate the Basic Auth header using the client ID and secret return 'Authorization: Basic ' . base64_encode($client_id . ':' . $client_secret); } }