$url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer " . $bearerToken, "Accept: application/json" ] ]); // Execute the request $response = curl_exec($ch); // Handle errors if (curl_errno($ch)) { echo "cURL Error: " . curl_error($ch); curl_close($ch); return null; } $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // Check for successful response if ($httpCode === 200 && $response) { return json_decode($response, true); } else { echo "Request failed. HTTP Code: " . $httpCode . "\nResponse: " . $response; return null; } } ?>