Twilio with Laravel - Error: XML declaration allowed only at the start of the document -


i'm getting following error when trying access 1 of routes on twilio using laravel.

error on line 2 @ column 6: xml declaration allowed @ start of document

the cause seems there empty 1st line in xml document rendered library because i've tested on different installation , didn't have same error. however, not know how go removing it. i've looked elsewhere online , the've suggested removing spaces preceding php tag, i've tried, hasn't worked.

how remove first line in 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;  }); 

service_twilio_twiml() sets response header xml, no need again. remove line , try again $response->header('content-type', 'text/xml');


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -