I'm getting the following error when trying to access one of my routes on Twilio using Laravel.
error on line 2 at column 6: XML declaration allowed only at the start of the document
The cause seems to be that there is an empty 1st line in the XML document rendered by the library because I've tested it on a different installation and it didn't have the same error. However, I do not know how to go about removing it. I've looked elsewhere online and the've suggested removing any spaces preceding the php tag, which I've tried, but it hasn't worked.
How do I remove the first line in the XML file generated?
Route::get('/outbound', function()
{
$sayMessage = "Hello";
$twiml = new Services_Twilio_Twiml();
$twiml->say($sayMessage, array(
'voice' => 'alice',
'language' => 'en-GB'
));
$twiml->gather(array(
'action' => '/goodbye',
'method' => 'GET',
));
$response = Response::make($twiml, 200);
$response->header('Content-Type', 'text/xml');
return $response;
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire