How can the PHP code snippet provided be improved to better handle authentication requirements for the chatwoot API?

The PHP code snippet can be improved by adding authentication headers to the cURL request to the Chatwoot API. This will ensure that the request is properly authenticated with the required credentials.

<?php

$api_url = 'https://your-chatwoot-url.com/api/v1/conversations';
$api_token = 'your-api-token';

$headers = array(
    'Content-Type: application/json',
    'Authorization: Bearer ' . $api_token
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if($response === false){
    echo 'Error: ' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);

?>